Skip to content

Commit

Permalink
mongodb: Update docs to reflect input metadata and string interpolati…
Browse files Browse the repository at this point in the history
…on for collections (#109)
  • Loading branch information
gregfurman committed Sep 1, 2024
1 parent a365007 commit a776641
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
17 changes: 16 additions & 1 deletion internal/impl/mongodb/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,22 @@ func mongoConfigSpec() *service.ConfigSpec {
Version("1.0.0").
Categories("Services").
Summary("Executes a query and creates a message for each document received.").
Description(`Once the documents from the query are exhausted, this input shuts down, allowing the pipeline to gracefully terminate (or the next input in a [sequence](/docs/components/inputs/sequence) to execute).`).
Description(`
Once the documents from the query are exhausted, this input shuts down, allowing the pipeline to gracefully terminate (or the next input in a [sequence](/docs/components/inputs/sequence) to execute).
### Metadata
This input adds the following metadata fields to each message:
` + "```text" + `
- mongo_database
- mongo_collection
` + "```" + `
You can access these metadata fields using
[function interpolation](/docs/configuration/interpolation#bloblang-queries).
`).
Fields(clientFields()...).
Field(service.NewStringField("collection").Description("The collection to select from.")).
Field(service.NewStringEnumField("operation", FindInputOperation, AggregateInputOperation).
Expand Down
2 changes: 1 addition & 1 deletion internal/impl/mongodb/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func outputSpec() *service.ConfigSpec {
Description(service.OutputPerformanceDocs(true, true)).
Fields(clientFields()...).
Fields(
service.NewStringField(moFieldCollection).
service.NewInterpolatedStringField(moFieldCollection).
Description("The name of the target collection."),
outputOperationDocs(OperationUpdateOne),
writeConcernDocs(),
Expand Down
2 changes: 1 addition & 1 deletion internal/impl/mongodb/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func ProcessorSpec() *service.ConfigSpec {
Description("").
Fields(clientFields()...).
Fields(
service.NewStringField(mpFieldCollection).
service.NewInterpolatedStringField(mpFieldCollection).
Description("The name of the target collection."),
processorOperationDocs(OperationInsertOne),
writeConcernDocs(),
Expand Down
14 changes: 14 additions & 0 deletions website/docs/components/inputs/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@ input:
Once the documents from the query are exhausted, this input shuts down, allowing the pipeline to gracefully terminate (or the next input in a [sequence](/docs/components/inputs/sequence) to execute).
### Metadata
This input adds the following metadata fields to each message:
```text
- mongo_database
- mongo_collection
```
You can access these metadata fields using
[function interpolation](/docs/configuration/interpolation#bloblang-queries).
## Fields
### `url`
Expand Down
1 change: 1 addition & 0 deletions website/docs/components/outputs/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Default: `""`
### `collection`

The name of the target collection.
This field supports [interpolation functions](/docs/configuration/interpolation#bloblang-queries).


Type: `string`
Expand Down
1 change: 1 addition & 0 deletions website/docs/components/processors/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Default: `""`
### `collection`

The name of the target collection.
This field supports [interpolation functions](/docs/configuration/interpolation#bloblang-queries).


Type: `string`
Expand Down

0 comments on commit a776641

Please sign in to comment.