node mongoose deprecation warning code example
Example 1: { useNewUrlParser: true } to MongoClient.connect. warnning
mongoose.connect("mongodb://localhost:27017/YourDB", { useNewUrlParser: true });
Example 2: DeprecationWarning: current Server Discovery and Monitoring engine is deprecated,
mongoose.connect("paste db link", {useUnifiedTopology: true, useNewUrlParser: true, useCreateIndex: true });
Example 3: 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 4: deprecationwarning: mongoose
mongoose.connect("mongodb://localhost/test1", { useNewUrlParser: true, useUnifiedTopology: true });
//test1 is databse name