mongodb
This component is experimental and therefore subject to change or removal outside of major version releases.
Executes a find query and creates a message for each row received.
Introduced in version 3.64.0.
- Common
- Advanced
# Common config fields, showing default values
input:
label: ""
mongodb:
url: mongodb://localhost:27017 # No default (required)
database: "" # No default (required)
username: ""
password: ""
collection: "" # No default (required)
query: |2 # No default (required)
root.from = {"$lte": timestamp_unix()}
root.to = {"$gte": timestamp_unix()}
# All config fields, showing default values
input:
label: ""
mongodb:
url: mongodb://localhost:27017 # No default (required)
database: "" # No default (required)
username: ""
password: ""
collection: "" # No default (required)
operation: find
json_marshal_mode: canonical
query: |2 # No default (required)
root.from = {"$lte": timestamp_unix()}
root.to = {"$gte": timestamp_unix()}
Once the rows 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
url
The URL of the target MongoDB server.
Type: string
# Examples
url: mongodb://localhost:27017
database
The name of the target MongoDB database.
Type: string
username
The username to connect to the database.
Type: string
Default: ""
password
The password to connect to the database.
This field contains sensitive information that usually shouldn't be added to a config directly, read our secrets page for more info.
Type: string
Default: ""
collection
The collection to select from.
Type: string
operation
The mongodb operation to perform.
Type: string
Default: "find"
Requires version 4.2.0 or newer
Options: find
, aggregate
.
json_marshal_mode
The json_marshal_mode setting is optional and controls the format of the output message.
Type: string
Default: "canonical"
Requires version 4.7.0 or newer
Option | Summary |
---|---|
canonical | 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. |
relaxed | 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. |
query
Bloblang expression describing MongoDB query.
Type: string
# Examples
query: |2
root.from = {"$lte": timestamp_unix()}
root.to = {"$gte": timestamp_unix()}