mongodb

EXPERIMENTAL: This component is experimental and therefore subject to change or removal outside of major version releases.

Performs operations against MongoDB for each message, allowing you to store or retrieve data within message payloads.

Introduced in version 3.43.0.

# Common config fields, showing default values
label: ""
mongodb:
url: mongodb://localhost:27017
database: ""
collection: ""
username: ""
password: ""
operation: insert
write_concern:
w: ""
j: false
w_timeout: ""
document_map: ""
filter_map: ""
hint_map: ""

Fields#

url#

The URL of the target MongoDB DB.

Type: string
Default: "mongodb://localhost:27017"

# Examples
url: mongodb://localhost:27017

database#

The name of the target MongoDB DB.

Type: string
Default: ""

collection#

The name of the target collection in the MongoDB DB.

Type: string
Default: ""

username#

The username to connect to the database.

Type: string
Default: ""

password#

The password to connect to the database.

Type: string
Default: ""

operation#

The mongodb operation to perform. Must be one of the following: insert-one, delete-one, delete-many, replace-one, update-one, find-one.

Type: string
Default: "insert"

write_concern#

The write_concern settings for the mongo connection.

Type: object

write_concern.w#

W requests acknowledgement that write operations propagate to the specified number of mongodb instances.

Type: string
Default: ""

write_concern.j#

J requests acknowledgement from MongoDB that write operations are written to the journal.

Type: bool
Default: false

write_concern.w_timeout#

The write concern timeout.

Type: string
Default: ""

document_map#

A bloblang map representing the records in the mongo db. Used to generate the document for mongodb by mapping the fields in the message to the mongodb fields. The document map is required for the operations insert-one, replace-one and update-one.

Type: array
Default: ""

# Examples
document_map:
- |-
root.a = this.foo
root.b = this.bar

filter_map#

A bloblang map representing the filter for the mongo db command. The filter map is required for all operations except insert-one. It is used to find the document(s) for the operation. For example in a delete-one case, the filter map should have the fields required to locate the document to delete.

Type: array
Default: ""

# Examples
filter_map:
- |-
root.a = this.foo
root.b = this.bar

hint_map#

A bloblang map representing the hint for the mongo db command. This map is optional and is used with all operations except insert-one. It is used to improve performance of finding the documents in the mongodb.

Type: array
Default: ""

# Examples
hint_map:
- |-
root.a = this.foo
root.b = this.bar

parts#

An optional array of message indexes of a batch that the processor should apply to. If left empty all messages are processed. This field is only applicable when batching messages at the input level.

Indexes can be negative, and if so the part will be selected from the end counting backwards starting from -1.

Type: array
Default: []

max_retries#

The maximum number of retries before giving up on the request. If set to zero there is no discrete limit.

Type: number
Default: 3

backoff#

Control time intervals between retry attempts.

Type: object

backoff.initial_interval#

The initial period to wait between retry attempts.

Type: string
Default: "1s"

backoff.max_interval#

The maximum period to wait between retry attempts.

Type: string
Default: "5s"

backoff.max_elapsed_time#

The maximum period to wait before retry attempts are abandoned. If zero then no limit is used.

Type: string
Default: "30s"