📜  `useFindAndModify` 是一个无效选项. - Javascript代码示例

📅  最后修改于: 2022-03-11 15:04:16.838000             🧑  作者: Mango

代码示例1
//***** 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