bulkwrite MongoDB matriz de objetos
var arrToUpdate = [
{_id:0,name:"Dennis"},
{_id:1,name:"Peter"},
{_id:2,name:"Ghandi"}
];
collection.bulkWrite(
arrToUpdate.map( d => ({
"replaceOne": {
"filter": { "_id": d._id },
"replacement": d
}
})),
function(err,result) {
console.log(result)
}
)
Vishal