首页 > 解决方案 > 使用 Pentaho 进行 MongoDB 到 MongoDB 文档迁移

问题描述

我在 DB01,MongoDb 中有这样的文件

在此处输入图像描述 我想在其他 MongoDB 中更新此文档,查看文档中的 key(_id)。

我的 Pentaho 工作非常简单: 在此处输入图像描述

您可以看到我正确获取了数据。例如,如何使用查找 _id 的键更新整个文档?

提前致谢。

问候!

标签: mongodbetlpentaho-spoon

解决方案


在您的“MongoDB 输入”预览中,我看到您的记录具有正确的“_id”值。好的,现在您只需要在“MongoDB 输入”步骤中选择所有字段而不是“输出单个 JSON 字段”。

而且,在“MongoDB 输出”步骤中,您需要在 _Id 的“匹配字段以更新”字段中设置 Y。

我已经为您的Here准备了一个示例转换。

Before run my transformation do the following things:-
First create 2 collection with same '_id ' and different 'qty'.

db.products.insert( { _id: 10, item: "box", qty: 20 } )
db.products2.insert( { _id: 10, item: "box", qty: 2 } )

Take input from db.products and update record on db.products2 
only if '_id' is match. 

推荐阅读