首页 > 其他 > 详细

To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

时间:2020-01-31 23:46:33      阅读:244      评论:0      收藏:0      [点我收藏+]

mongoose报错:DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
其实我们阅读报的警告就可以解决:在mongoose连接的时候在第二个参数的对象中加入

  useUnifiedTopology: true   

即为:

mongoose.connect(dbConfig.dbs, {
  useNewUrlParser: true,
  useUnifiedTopology: true     //这个即是报的警告
}).then(res => {
  console.log('数据库连接成功')
})

To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

原文:https://www.cnblogs.com/nayek/p/12247083.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!