【问题标题】:{useNewUrlParser: true, useUnifiedTopology: true} what is the use of this in mongoose [duplicate]{useNewUrlParser: true, useUnifiedTopology: true} 这个在猫鼬中有什么用[重复]
【发布时间】:2021-09-14 23:31:31
【问题描述】:

安装猫鼬后

const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/test', {useNewUrlParser: true, useUnifiedTopology: true});

useNewUrlParser 和 useUnifiedToplogy 有什么用?

【问题讨论】:

标签: node.js mongodb mongoose


【解决方案1】:

根据the documentation

-->unifiedtopology : DeprecationWarning: current Server Discovery and Monitoring engine is 已弃用,并将在未来的版本中删除。使用新服务器 发现和监控引擎,将选项 { useUnifiedTopology: true } 传递给 MongoClient 构造函数。

-->usenewurlparser : DeprecationWarning:当前的 URL 字符串解析器已被弃用,并将被 在未来的版本中删除。要使用新的解析器,请传递选项 { useNewUrlParser: true } 到 MongoClient.connect。

【讨论】:

    猜你喜欢
    • 2021-12-18
    • 2015-01-10
    • 2021-01-09
    • 2019-12-07
    • 1970-01-01
    • 2013-02-02
    • 2019-08-12
    • 1970-01-01
    相关资源
    最近更新 更多