Why the bulk y replacing other fields if upsert is declare?
What am i doing wrong?
original collection:
{
_id:'xx',
a:1
}
process
var bulk = collection.initializeUnorderedBulkOp();
users.forEach(x => {
bulk
.find({ _id:'xx'})
.upsert()
.updateOne({
b: 2
});
});
bulk.execute();
result
{
_id:'xx',
b:2
}