mongoose bulk update

Solutions on MaxInterview for mongoose bulk update by the best coders in the world

showing results for - "mongoose bulk update"
Carlos
06 Nov 2016
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});