我们可以在 mongodb 中更新/更新记录吗?数据源是kafka [英] Can we update/Upsert a record in mongodb? data source is kafka

查看:19
本文介绍了我们可以在 mongodb 中更新/更新记录吗?数据源是kafka的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在 mongodb 中更新/更新记录,但是如果有任何方法或函数可以直接在 mongodb 中更新或更新文档,并且源系统是 kafka,目标是 mongodb.

We can update/upsert the record in mongodb BUT is there is any method or function from which we can update or upsert the document directly in mongodb and the source system is kafka and destination is mongodb.

推荐答案

是的,我们可以更新/更新数据.对于更新,您必须在 Kafka 连接器中定义一个参数.并将要更新记录的基础列列入白名单.属性如下:

Yes we can update/upsert the data. For update you have to define a parameter in Kafka connector. and whitelist the column on which bases you want to update the record. The property is as followed:

document.id.strategy=com.mongodb.kafka.connect.sink.processor.id.strategy.PartialValueStrategy
value.projection.list=tokenNumber
value.projection.type=whitelist
writemodel.strategy=com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneTimestampsStrategy

这篇关于我们可以在 mongodb 中更新/更新记录吗?数据源是kafka的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆