-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
Was: Change of behaviour in 1.5 in sink for mapping / document id strategy
There has been reported a change in the behaviour between 1.4 & 1.5 for a complex mapping / document id strategy.
"writemodel.strategy": "com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneBusinessKeyTimestampStrategy", "post.processor.chain": "com.mongodb.kafka.connect.sink.processor.field.renaming.RenameByMapping,com.mongodb.kafka.connect.sink.processor.DocumentIdAdder", "field.renamer.mapping": "[{\"oldName\":\"value.c\",\"newName\":\"_id\"}]", "document.id.strategy": "com.mongodb.kafka.connect.sink.processor.id.strategy.PartialValueStrategy", "document.id.strategy.overwrite.existing": "true", "document.id.strategy.partial.value.projection.type": "allowlist", "document.id.strategy.partial.value.projection.list": "a, b, _id",
The UpdateOneBusinessKeyTimestampStrategy appears to be adding a new ObjectId instead of using the mapped one as defined by field.renamer.mapping.
The workaround has been to use SMT to handle the remapping:
"transforms": "RenameField", "transforms.RenameField.type": "org.apache.kafka.connect.transforms.ReplaceField$Value", "transforms.RenameField.renames": "c:_id",