Skip to content

MongoDB

MongoDB (mongodb)

Write events to MongoDB collections.

Database Enterprise edition json

Minimal example

output:
mongodb:
collection: ~
database: ~
operation:
insert-one: {}
uri: ""
JSON
{
"output": {
"mongodb": {
"collection": null,
"database": null,
"operation": {
"insert-one": {}
},
"uri": ""
}
}
}

Contents

Batching

Batching
FieldTypeRequiredDescription
batchBatchOptional output batching hints (used by insert-many).

Connection

Connection
FieldTypeRequiredDescription
uriurl (string)MongoDB connection URI.
Examples: https://example.com/path
databasestringDatabase name.
collectionstringCollection name.

Operation

Operation
FieldTypeRequiredDescription
operationOperationWrite operation to execute.
Allowed values: insert-one, insert-many, replace-one, update-one

Reliability

Reliability
FieldTypeRequiredDescription
retryRetryRetry policy for failed writes.

Schema

Operation Options

OptionNameTypeDescription
insert-oneInsert OneobjectInsert a single document.
insert-manyInsert ManyobjectInsert one or many documents. When the selected value is an array, each element is inserted.
replace-oneReplace OneobjectReplace a single matched document.
update-oneUpdate OneobjectUpdate a single matched document.

Batch Fields

FieldTypeRequiredDescription
fixed-sizenumber (integer)maximum number of events in an output batch.
Examples: 42, 1.2e-10
modeModeIf ‘document’ send on end of document generated by input. If ‘fixed’, use fixed_size.
Allowed values: fixed, document
timeouttime-interval (string)interval after which the batch is sent, to keep throughput going (default 100ms).
Default: 100ms
Examples: 500ms, 2h
headermultiline-text (string)put a header line before the batch.
footermultiline-text (string)put a header line after the last line of the batch.
use-document-markerboolean (bool)Enrich the job metadata with a document marker (for document handling in batch mode).
Default: false
wrap-as-jsonboolean (bool)Format the output batch as a JSON array.
Default: false

Operation - Insert One Fields

FieldTypeRequiredDescription
document-fieldfield (string)Optional event field containing the document to insert. Defaults to the entire event.
Examples: data_field

Operation - Insert Many Fields

FieldTypeRequiredDescription
document-fieldfield (string)Optional event field containing the document(s) to insert. Defaults to the entire event.
Examples: data_field

Operation - Replace One Fields

FieldTypeRequiredDescription
filter-fieldfield (string)Event field that resolves to the filter document.
Examples: data_field
replacement-fieldfield (string)Event field containing replacement document. Defaults to the entire event.
Examples: data_field
upsertboolean (bool)Create the document when no match exists.
Default: false

Operation - Update One Fields

FieldTypeRequiredDescription
filter-fieldfield (string)Event field that resolves to the filter document.
Examples: data_field
update-fieldfield (string)Event field containing update document. Defaults to the entire event.
Examples: data_field
upsertboolean (bool)Create the document when no match exists.
Default: false

Retry Fields

FieldTypeRequiredDescription
timeouttime-interval (string)timeout (e.g. 500ms, 2s etc. - default is 30).
Examples: 500ms, 2h
retriesnumber (integer)number of retries.
Examples: 42, 1.2e-10

Batch - Mode Options

ValueNameDescription
fixedfixedFixed
documentdocumentDocument