I’m trying to perform following bulk Update Operation by _id:
let bulk = Transactions.rawCollection().initializeOrderedBulkOp();
transactions.forEach((t) => {
let query = { '_id' : new Meteor.Collection.ObjectID(t._id._str) };
bulk.find( query ).update( { $set: { balance: t.balance, updated_at: new Date() } } );
});
bulk.execute(Meteor.bindEnvironment((err, res) => {
if (!err) {
callback(null, true);
} else {
console.log("Error Ocurred");
callback(true, null);
}
}));
But This find query by Id is not working. If I do query by any other field It works just fine. But I can’t do that because Collection has only one Unique field as ‘_id’.
Help Needed. TIA