1const bulk = db.items.initializeUnorderedBulkOp();
2bulk.find( { status: "D" } ).update( { $set: { status: "I", points: "0" } } );
3bulk.find( { item: null } ).update( { $set: { item: "TBD" } } );
4bulk.execute();
5
1Character.bulkWrite([
2 {
3 updateMany: {
4 filter: { name: 'Eddard Stark' },
5 // If you were using the MongoDB driver directly, you'd need to do
6 // `update: { $set: { title: ... } }` but mongoose adds $set for
7 // you.
8 update: { title: 'Hand of the King' }
9 }
10 }
11]).then(res => {
12 // Prints "1 1 1"
13 console.log(res.modifiedCount);
14});