【问题标题】:DeprecationWarning: current URL string parser is deprecated on starting server弃用警告:当前 URL 字符串解析器在启动服务器上已弃用
【发布时间】:2020-01-22 17:29:00
【问题描述】:

在启动 npm 时出现此消息“DeprecationWarning: current URL string parser is deprecated, and will be removed in the future version. 若要使用新的解析器,请将选项 { useNewUrlParser: true } 传递给 MongoClient.connect。”

【问题讨论】:

  • 我在link找到了答案。

标签: mongodb warnings connect deprecated


【解决方案1】:

所以,对于这个和其他过时的警告,我已经这样做了:

mongoose.connect('mongodb://localhost:27017/databasename', { useUnifiedTopology: true, useNewUrlParser: true, useCreateIndex: true }, (err, res) => {

【讨论】:

  • 你是在哪个文件里做的?
  • 在 index.js 文件中
猜你喜欢
  • 2018-12-12
  • 2019-02-21
  • 1970-01-01
  • 2021-11-22
  • 2018-01-23
  • 2020-02-22
  • 1970-01-01
  • 2020-08-25
  • 1970-01-01
相关资源
最近更新 更多