Last active
April 17, 2022 18:36
-
-
Save countnazgul/24f816607fe7608e58ea to your computer and use it in GitHub Desktop.
[Batch update records] #mongo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OrderId = [1,2,3,4,5,6] | |
BulkUpdate(OrderId, function() { | |
console.log('done'); | |
}); | |
function BulkUpdate(OrderId, callback) { | |
Model.update( | |
{ orderid : { $in: OrderId } }, | |
{ $set: { status: 'complete' } }, | |
{ multi : true}).exec(callback); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment