mongodb
Executes a query and creates a message for each document received.
-
Common
-
Advanced
inputs:
label: ""
mongodb:
url: "" # No default (required)
database: "" # No default (required)
username: ""
password: ""
collection: "" # No default (required)
query: "" # No default (required)
auto_replay_nacks: true
batch_size: "" # No default (optional)
sort: "" # No default (optional)
limit: "" # No default (optional)
inputs:
label: ""
mongodb:
url: "" # No default (required)
database: "" # No default (required)
username: ""
password: ""
app_name: benthos
collection: "" # No default (required)
operation: find
json_marshal_mode: canonical
query: "" # No default (required)
auto_replay_nacks: true
batch_size: "" # No default (optional)
sort: "" # No default (optional)
limit: "" # No default (optional)
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 to execute).
Fields
auto_replay_nacks
Whether messages that are rejected (nacked) at the output level should be automatically replayed indefinitely, eventually resulting in back pressure if the cause of the rejections is persistent. If set to false these messages will instead be deleted. Disabling auto replays can greatly improve memory efficiency of high throughput streams as the original shape of the data can be discarded immediately upon consumption and mutation.
Type: bool
Default: true
batch_size
A explicit number of documents to batch up before flushing them for processing. Must be greater than 0. Operations: find, aggregate
Type: int
# Examples:
batch_size: 1000
json_marshal_mode
The json_marshal_mode setting is optional and controls the format of the output message.
Type: string
Default: canonical
| Option | Summary |
|---|---|
|
A string format that emphasizes type preservation at the expense of readability and interoperability. That is, conversion from canonical to BSON will generally preserve type information except in certain specific cases. |
|
A string format that emphasizes readability and interoperability at the expense of type preservation.That is, conversion from relaxed format to BSON can lose type information. |
password
The password to connect to the database.
|
This field contains sensitive information that usually shouldn’t be added to a configuration directly. For more information, see Manage Secrets before adding it to your configuration. |
Type: string
Default: ""
query
Bloblang expression describing MongoDB query.
Type: string
# Examples:
query: |-
root.from = {"$lte": timestamp_unix()}
root.to = {"$gte": timestamp_unix()}