i want to sync to collection with mongo kafka connect and apply insert,delete,update with the same _id in source and sink collection , but i can not achieve it after long time …
here is my event in kafka topic cames from source :
"{\"_id\": {\"_data\": \"826595357A000000012B022C0100296E5A10043CD85CD46170439FAF6A4C1A1C1E025F461E5F6964002B020004\"}, \"operationType\": \"insert\", \"clusterTime\": {\"$timestamp\": {\"t\": 1704277370, \"i\": 1}}, \"wallTime\": {\"$date\": 1704277370036}, \"fullDocument\": {\"_id\": 1, \"name\": \"amir\"}, \"ns\": {\"db\": \"test\", \"coll\": \"orders\"}, \"documentKey\": {\"_id\": 1}}"
i want to insert data in mongo with the _id that exist in documentKey and use this field for update and delete , can any one help me please
![]()
here is source config:
{
"name": "mongo-source-connector",
"config": {
"connector.class": "com.mongodb.kafka.connect.MongoSourceConnector",
"tasks.max": "1",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable": "false",
"connection.uri": "***********************",
"database": "test",
"collection": "orders",
"copy.existing": "true",
"publish.full.document.only": "false"
}
}