mongoose.set('useFindAndModify', false);
await mongoose.connect('mongodb://localhost:27017/test', {
useNewUrlParser: true, // <-- no longer necessary
useUnifiedTopology: true // <-- no longer necessary
});
//***** It's a deprecated now. // No longer necessary: *******
mongoose.set('useFindAndModify', false); //No longer necessary
await mongoose.connect('mongodb://localhost:27017/test', {
useNewUrlParser: true, // <-- no longer necessary
useUnifiedTopology: true // <-- no longer necessary
});
// ******************** use this line of code ************
mongoose.connect(CONNECTION_URL).then(()=>{console.log('...')})
//read more: https://mongoosejs.com/docs/migrating_to_6.html#mongoose-connect-returns-a-promise