Schema Requirement
The source schema must contain a single field named_json of type string. Each value in this field is a JSON document that will be written to the target collection.
JSON Modes
The JSON input mode is controlled byeveryRowContainsObject in the source fileAttributes.jsonAttributes:
| Value | Description |
|---|---|
true | Each line of the file is a separate JSON document (newline-delimited JSON). Default. |
false | The file contains a single JSON array; each element becomes a separate document. |
Upsert with Compound Keys
Specify one or more fields inkeyFields to perform an upsert instead of a plain insert. The pipeline matches existing documents by the compound key formed from these fields. If a matching document exists it is replaced; otherwise a new document is inserted.
Truncate Before Write
SettruncateBeforeWrite to true to delete all documents from the target collection before writing. This effectively replaces the entire collection on each run.
Transaction Support
All write operations execute inside a MongoDB transaction. If any error occurs during the write, the transaction is aborted and no partial data is persisted.Configuration Example
application.yaml via secrets.mongoDbSecretName. See Configuration Reference for Vault secret format.
Field Reference
| Field | Required | Default | Description |
|---|---|---|---|
dbName | yes | Target database name | |
table | yes | Target collection name | |
useMongoDB | yes | false | Must be true to enable MongoDB destination |
keyFields | no | Array of field names forming the compound upsert key | |
truncateBeforeWrite | no | false | Delete all documents before writing |
useTransaction | no | false | Wrap all writes in a MongoDB transaction |