[英]append field value in inline json array object in mongo through kafka mongo sink connector
publish first insertion :发布第一个插入:
{"Customer_id": 2, "transaction_id": "1", "idd": [999, 1111], "id": 1}
and then second one :然后第二个:
{"Customer_id": 2, "transaction_id": "2", "idd": [9, 10], "id": 1}
required result :要求的结果:
{"Customer_id": 2, "transaction_id": "2", "idd": [[9, 10] , [999, 1111]], "id": 1}
what i get:我得到了什么:
{"Customer_id": 2, "transaction_id": "2", "idd": [9, 10] , "id": 1}
update strategy this update array not append but my expected result to append array更新策略此更新数组不追加但我预期的结果追加数组
configuration :配置 :
document.id.strategy=com.mongodb.kafka.connect.sink.processor.id.strategy.PartialValueStrategy
value.projection.list=customer_id,transaction_id
value.projection.type=whitelist
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.ReplaceOneBusinessKeyStrategy
how can we do this through mongo-kafka sink connector我们如何通过 mongo-kafka sink 连接器做到这一点
Looks like you're trying to aggregate streaming data看起来您正在尝试聚合流数据
Unless MongoDB somehow is able to provide this functionality via inserting the same document ID (which I doubt because how does it know that you only want to collect the idd field?), you would have to use Kafka Streams / KSQL or another stateful processing layer, to aggregate your values.除非 MongoDB 以某种方式能够通过插入相同的文档 ID 来提供此功能(我对此表示怀疑,因为它如何知道您只想收集 idd 字段?),否则您将不得不使用 Kafka Streams / KSQL 或其他有状态处理层, 汇总您的价值。 The sink connector just forwards whatever it sees into the database ;
接收器连接器只是将它看到的任何内容转发到数据库中; the connector has no knowledge of previous records
连接器不知道以前的记录
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.