Parameterize the couchbase.subdocument.path field

Hi, I am using Kafka Sink Connector for Couchbase.

I have a field in the Couchbase document which is productIds. This field is a map for storing productIds. So, I want to add new productId to this map. But when I set productIds to field couchbase.subdocument.path. The field is overwritten with new data and old values are gone in the map.

So, I want to parametrize the field couchbase.subdocument.path like productIds.{productId}. So I will hope that when I pass a productId in the event will be retrieved and the variable will be use for sub document operation. And the existing values will not gone.

How can I achieve this?

The sample document content like this:
Document key: 987

{
    memberId: 987
    productIds: {
        "123": true,
        "235": true,
        "245": true
    }
}

@david.nault do you have any opinion for this?

Hi @sinkconnector,

I’m not aware of a way to get the connector to update a JSON object like that, unless you write a custom SinkHandler.

If productIds were an array, you might be able to use couchbase.subdocument.operation = ARRAY_APPEND to append the value of the Kafka record to the array.

Thanks,
David

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.