简体   繁体   English

通过 kafka mongo sink 连接器在 mongo 中的内联 json 数组对象中附加字段值

[英]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.

相关问题 mongo db sink 连接器,kafka 消息密钥到 mongodb 文档字段 - mongo db sink connector, kafka message key to mongodb document field 使用 mongo-kafka 作为接收器连接器,如何将字段的值设置为 Date 类型? - Using mongo-kafka as sink connector, how do I set a field's value to be of Date type? Kafka Mongo Sink 连接器,如何将 SMT 时间戳转换器用于 JSON 数组中归档的日期 - Kafka Mongo Sink connector , how to use SMT timestampconverter for the date filed inside a JSON array 将dockerized kafka接收器连接器实现到mongo - Implement dockerized kafka sink connector to mongo 使用 mongo-kafka 作为接收器连接器,我如何将主题记录的值字段 map 转换为另一个值? - Using mongo-kafka as sink connector, how do I map a topic record's value field to another value? 更新 Kafka sink mongo 上的部分字段 - Update partial field on Kafka sink mongo 对于 Kafka mongo 水槽连接器,我想要 map 相同的 Object 现有 ID - For Kafka mongo sink connector I want to map same Object ID which is existing 如何运行 mongo-kafka 连接器作为 kafka 的源并将其与 logstash 输入集成以使用 elasticsearch 作为接收器? - How to run the mongo-kafka connector as a source for kafka and integrate that with logstash input to use elasticsearch as a sink? Mongo kafka 连接器,解串器问题 - Mongo kafka connector, deserializer question 使用Mongo查询数组中对象中的字段? - Query for a field in an object in array with Mongo?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM