如何将生产的JSON密钥设置为MongoDB Atlas的文档_id
我正在构建一个数据管道,在那里我通过KAFKA将刮擦数据发送到MongoDB Atlas(全部在云中,而不是本地)。
我用我的Contruent Kafka配置初始化了一个生产者P。然后,我从Internet中提取我列表中每个公司的WKN和ISIN。我以JSON格式将这些数据发送到Kafka。 请参阅此处:
p.produce(
"wkns_and_isins",
key=company,
value=identification_numbers,
callback=delivery_report,
)
现在,当我将JSON数据发送到我的云管理的MongoDB地图集时,我想将JSON-KEY设置为文档“ _id”。因此,我正在使用MongoDB Atlas水槽连接器。 在MongoDB中,应该看起来像这样:
{
_id: 'Adidas',
value: 'XXX / XXX'
}
它将如何工作?
I am building a data pipeline, where I am sending scraped data via Kafka to mongoDB Atlas (all in the cloud, not local).
I initialized a Producer p with my Confluent Kafka configs. Then I extract WKNs and ISINs of every company I have in my list from the internet. I am sending this data in JSON format to Kafka.
See here:
p.produce(
"wkns_and_isins",
key=company,
value=identification_numbers,
callback=delivery_report,
)
Now I want to set the JSON-key as the document "_id" when I am sending the JSON data to my cloud-managed mongoDB Atlas. Therefore I am using the MongoDB Atlas Sink Connector.
In the mongoDB it should look like this:
{
_id: 'Adidas',
value: 'XXX / XXX'
}
How will that work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论