The problem of updating mongodb with mongoose

  mongodb, question

Knowing mongodb can insert when there is no data and update when there is data by setting the third parameter of UPDATE to true.
How does the update method encapsulated by mongoose pass in this parameter?
Mongoose’s document provides the three parameters of update(doc, options, callback)

http://mongoosejs.com/docs/ap …

clipboard.png

MyModel.update({ name: ‘Tobi’ }, { ferret: true }, { upsert: true }, function (err, raw) {
if (err) return handleError(err);
console.log(‘The raw response from Mongo was ‘, raw);
});