1. Create a temporary collection
  2. Use the add data to import your data into the temp collection
  3. Open the mongod console, and run the following line

db.TEMPCOLLECTIONNAME.aggregate([{$merge:{into:{coll:'TARGET COLLECTION NAME',db:'TARGET DB NAME'},on:'_id'}}])

Obviously replace the 3 names. You can leave out the DB property if the temp collection is in the same db as the target.


db.TEMPCOLLECTIONNAME.aggregate([{$merge:{into:{coll:'TARGET COLLECTION NAME'},on:'_id'}}])
  1. example
  db.temp.aggregate([{$merge:{into:{coll:'consultation'},on:'_id'}}])