I want to upsert the result of a find() query into another collection.
Currently I do it this way:
db.source_collection.find(
{ <my filters> },
{ <my columns> }
).forEach(function (doc) {
db.target_collection.update(
{ <my key > },
{ <my fields to upsert> }
{ multie : true, upsert: true }
)
})
Is there faster way to do this?