Batch update with Mongoose

On MongoDB, to update multiple documents (not just one) using Mongoose you can use the multi option:

Model.updateMany({ 
  size: 'lage'
}, { 
  $set: { size: 'large' }
});

See more on in the Mongoose documentation for updating documents and here


For completeness, If any one has multiple query conditions and want to add new fields for every matching documents of query condition then we can go with

var bulk = Person.collection.initializeUnorderedBulkOp();
bulk.find(query1).update(update1);
bulk.find(query2).update(update2);
bulk.execute(callback);

In following documentation, it is said that db.collection.initializeUnorderedBulkOp()

Initializes and returns a new Bulk() operations builder for a collection. The builder constructs an unordered list of write operations that MongoDB executes in bulk. MongoDB executes in parallel the write operations in the list.

https://docs.mongodb.org/v3.0/reference/method/db.collection.initializeUnorderedBulkOp/