node.js - Error with using mongoose package for connection
问题描述
DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser...
{ useUnifiedTopology: true },
{ useNewUrlParser: true }
解决方案
It's because every option passed should be one object like this
{ useUnifiedTopology: true ,
useNewUrlParser: true }
Full Connection could be like
mongoose.connect(URL, {
useUnifiedTopology: true ,
useNewUrlParser: true
}
).then(() => {
console.log('Successfully connected to the database');
}).catch(err => {
console.log(`Could not connect to the database.. ${err}`);
process.exit();
});
推荐阅读
- python - Django - 解析 URL 以获取对象并保存它
- php - 代码点火器电子邮件失败“遇到 SMTP 错误:550 未知用户”
- android - DrawerLayout 没有显示在我的预览窗口中。如何解决这个问题?
- python - 为什么python在关闭fifo文件时会生成sigpipe异常?
- javascript - 了解 JavaScript 中的 Promise 构造函数
- java - 测试未能完成。原因:'测试运行未能完成。预期 1 个测试,收到 0'。检查设备 logcat 以获取详细信息
- python - 在日期列表中查找最近的过去日期
- laravel - 如何从laravel中的不同字段上传多个文件
- r - 合并两个数据帧,同时使用 R 在它们之间保留不常见的行
- mongodb - Mongodb 文档模式仅包含关键信息