Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
ml1662663516
Contributor II
Contributor II

MongoDB - Possible to update documents using a where/set clause?

I know in mongo I can use a set clause to update document fields based on their value.

Basically, I need to update all documents in a collection where their date field is null and set their date field to the current date. If their date field is not null then they should not be updated.

I cannot figure out how to do this in Talend.

Any ideas? Thank you!

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hello @Mark Lammert​ ,

Unfortunately, it's impossible to update documents using where /set clause.

However, for your case, you can use tMap to setup a filter for the input rows and use tMongoDBOutput​ with Action on Data=Update to update the documents like the below

0695b00000huri5AAA.pngBest regards

Aiming

 

View solution in original post

2 Replies
Anonymous
Not applicable

Hello @Mark Lammert​ ,

Unfortunately, it's impossible to update documents using where /set clause.

However, for your case, you can use tMap to setup a filter for the input rows and use tMongoDBOutput​ with Action on Data=Update to update the documents like the below

0695b00000huri5AAA.pngBest regards

Aiming

 

ml1662663516
Contributor II
Contributor II
Author

Thank you. Did not know you could do this. Thank you for sharing.

 

Man, it would be awesome if you could write set and update JSON just like you can write find query JSON.

 

Thank you!