MongoDB
MongoDB (mongodb)
Section titled “MongoDB (mongodb)”Write events to MongoDB collections.
Database Licensed editions json
Minimal example
Section titled “Minimal example”output: mongodb: collection: ~ database: ~ uri: ""JSON
{ "output": { "mongodb": { "collection": null, "database": null, "uri": "" } }}Contents
Section titled “Contents”A ✓ marks a field that accepts a context variable such as
{{ VARIABLE }}.
Fields
Section titled “Fields”| Field | Type | Required | Description |
|---|---|---|---|
insert-one |
Insert One |
Insert a single document. | |
insert-many |
Insert Many |
Insert one or many documents. When the selected value is an array, each element is inserted. | |
replace-one |
Replace One |
Replace a single matched document. | |
update-one |
Update One |
Update a single matched document. |
Batching
Section titled “Batching”Batching
| Field | Type | Required | Description |
|---|---|---|---|
batch |
Batch |
Optional output batching hints (used by insert-many). |
Connection
Section titled “Connection”Connection
| Field | Type | Required | Description |
|---|---|---|---|
uri |
url (string) |
✅ | MongoDB connection URI. Examples: https://example.com/path |
database |
string |
✅ | Database name. |
collection |
string |
✅ | Collection name. |
Reliability
Section titled “Reliability”Reliability
| Field | Type | Required | Description |
|---|---|---|---|
retry |
Retry |
Retry policy for failed writes. |
Schema
Section titled “Schema”- Insert One Fields
- Insert Many Fields
- Replace One Fields
- Update One Fields
- Batch Fields
- Retry Fields
- Batch - Mode Options
Insert One Fields
Section titled “Insert One Fields”| Field | Type | Required | Description |
|---|---|---|---|
document-field |
field (string) |
Optional event field containing the document to insert. Defaults to the entire event. Examples: data_field |
Insert Many Fields
Section titled “Insert Many Fields”| Field | Type | Required | Description |
|---|---|---|---|
document-field |
field (string) |
Optional event field containing the document(s) to insert. Defaults to the entire event. Examples: data_field |
Replace One Fields
Section titled “Replace One Fields”| Field | Type | Required | Description |
|---|---|---|---|
filter-field |
field (string) |
✅ | Event field that resolves to the filter document. Examples: data_field |
replacement-field |
field (string) |
Event field containing replacement document. Defaults to the entire event. Examples: data_field |
|
upsert ✓ |
boolean (bool) |
Create the document when no match exists. Default: false |
Update One Fields
Section titled “Update One Fields”| Field | Type | Required | Description |
|---|---|---|---|
filter-field |
field (string) |
✅ | Event field that resolves to the filter document. Examples: data_field |
update-field |
field (string) |
Event field containing update document. Defaults to the entire event. Examples: data_field |
|
upsert ✓ |
boolean (bool) |
Create the document when no match exists. Default: false |
Batch Fields
Section titled “Batch Fields”| Field | Type | Required | Description |
|---|---|---|---|
fixed-size ✓ |
number (integer) |
maximum number of events in an output batch. Examples: 42, 1.2e-10 |
|
max-bytes ✓ |
number (integer) |
Close the batch before adding an event that would make the serialized request payload exceed this many bytes. Examples: 42, 1.2e-10 |
|
mode |
Mode |
✅ | If ‘document’ send on end of document generated by input. If ‘fixed’, use fixed_size.Allowed values: fixed, document |
timeout |
time-interval (string) |
✅ | interval after which the batch is sent, to keep throughput going (default 100ms). Default: 100msExamples: 500ms, 2h |
header |
multiline-text (string) |
put a header line before the batch. | |
footer |
multiline-text (string) |
put a header line after the last line of the batch. | |
use-document-marker ✓ |
boolean (bool) |
Enrich the job metadata with a document marker (for document handling in batch mode). Default: false |
|
wrap-as-json ✓ |
boolean (bool) |
Format the output batch as a JSON array. Default: false |
Retry Fields
Section titled “Retry Fields”| Field | Type | Required | Description |
|---|---|---|---|
count |
number (integer) |
The number of retry attempts. If unspecified, retries will continue indefinitely. Examples: 42, 1.2e-10 |
|
pause |
duration (string) |
How long to pause before re-trying. Accepts human-friendly formats, like 1m (for 1 minute) and 4h (for 4 hours) |
Batch - Mode Options
Section titled “Batch - Mode Options”| Value | Aliases | Name | Description |
|---|---|---|---|
fixed |
fixed | ||
document |
document |