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
| Field | Type | Required | Description |
|---|---|---|---|
batch | Batch | Optional output batching hints (used by insert-many). |
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. |
Operation
Operation
| Field | Type | Required | Description |
|---|---|---|---|
operation | Operation | ✅ | Write operation to execute. Allowed values: insert-one, insert-many, replace-one, update-one |
Reliability
Reliability
| Field | Type | Required | Description |
|---|---|---|---|
retry | Retry | Retry policy for failed writes. |
Schema
- Operation Options
- Batch Fields
- Operation - Insert One Fields
- Operation - Insert Many Fields
- Operation - Replace One Fields
- Operation - Update One Fields
- Retry Fields
- Batch - Mode Options
Operation Options
| Option | Name | Type | Description |
|---|---|---|---|
insert-one | Insert One | object | Insert a single document. |
insert-many | Insert Many | object | Insert one or many documents. When the selected value is an array, each element is inserted. |
replace-one | Replace One | object | Replace a single matched document. |
update-one | Update One | object | Update a single matched document. |
Batch Fields
| Field | Type | Required | Description |
|---|---|---|---|
fixed-size ✓ | number (integer) | maximum number of events in an output batch. 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 |
Operation - 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 |
Operation - 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 |
Operation - 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 |
Operation - 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 |
Retry Fields
| Field | Type | Required | Description |
|---|---|---|---|
timeout | time-interval (string) | ✅ | timeout (e.g. 500ms, 2s etc. - default is 30). Examples: 500ms, 2h |
retries | number (integer) | number of retries. Examples: 42, 1.2e-10 |
Batch - Mode Options
| Value | Name | Description |
|---|---|---|
fixed | fixed | Fixed |
document | document | Document |