Uploaded image for project: 'Kafka Connector'
  1. Kafka Connector
  2. KAFKA-218

LazyBsonDocument clone ignores changes

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.6.0
    • 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",
      

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            ross@mongodb.com Ross Lawley
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: