Thursday, 27 April 2017

Mongo DB: Provide input into one collection as query result from another collection

I am trying to copy records from one collection to another based on a condition using node.js. Is there some way I can achieve this? I've been trying to do the following - but don't know why it doesn't work.

db.MYCOLLECTION_TEST.insertMany(db.MYCOLLECTION.find({'WKFLOW_STA_TX':'COMPOSE'}))

I'm new to Mongo and trying to extend my knowledge in SQL here. However, I don't want to use the copyTo as it is deprecated after Mongo 3.0.



via Ramana Sarva

No comments:

Post a Comment