Tuyeyas
Tuyeyas

Reputation: 181

MongoDB to MongoDB document migration with Pentaho

I have a document like this in DB01,MongoDb

enter image description here I want to update this document in other MongoDB looking at a key(_id) inside the document.

My Pentaho job is really simple: enter image description here

You can see that I get the data correctly.How can I update the whole document with the key to lookup _id for example?

Thanks in advance.

Regards!

Upvotes: 0

Views: 304

Answers (1)

Ahmmed
Ahmmed

Reputation: 1048

In your 'MongoDB Input' preview, I have seen your records has proper '_id' values. Ok, now you just need to select all fields instead of 'Output single JSON field' in your 'MongoDB Input' step.

And, in your 'MongoDB output' step, you need to set Y in 'Matching field to update' field for _Id.

I have prepare a sample Transformation for your 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. 

Upvotes: 0

Related Questions