findbyidandupdate deprecated code example

Example 1: findbyidandupdate return old value

Model.findByIdAndUpdate(id, updateObj, {new: true}, function(err, model) {...

Example 2: https://mongoosejs.com/docs/deprecations.html#findandmodify

// Make Mongoose use `findOneAndUpdate()`. Note that this option is `true`
// by default, you need to set it to false.
mongoose.set('useFindAndModify', false);

Example 3: deprecationwarning: mongoose

mongoose.connect("mongodb://localhost/test1", { useNewUrlParser: true, useUnifiedTopology: true });
//test1 is databse name