Define the CRUD Operation

To write to MongoDB, ensure that the CRUD operation record header attribute is defined for each record earlier in the pipeline. Records without an operation record header attribute are sent to error.

To update and replace records, you must specify a unique key field. You can also enable upserts for update and replace records.

Note that when performing a DELETE operation, the destination deletes a maximum of one matching document in MongoDB. It does not delete all matching documents, as is sometimes possible with MongoDB.

To write records to MongoDB, make sure records include the following CRUD operation record header attribute:
sdc.operation.type
When defined, the MongoDB destination uses the CRUD operation in the sdc.operation.type record header attribute when writing to MongoDB. The MongoDB destination supports the following values for the sdc.operation.type attribute:
  • 1 for INSERT
  • 2 for DELETE
  • 3 for UPDATE
  • 7 for REPLACE
If your pipeline includes a CRUD-enabled origin that processes changed data, the destination simply reads the operation type from the sdc.operation.type header attribute that the origin generates. If your pipeline uses a non-CDC origin, you can use the Expression Evaluator or a scripting processor to define the record header attribute. For more information about Data Collector changed data processing and a list of CDC-enabled origins, see Processing Changed Data.