原文:关于nodejs DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.

const mongoose require mongoose mongoose.connect mongodb: localhost: study , useNewUrlParser:true , function err if err console.log Connection Error: err else console.log Connection success ...

2018-07-25 08:49 3 14153 推荐指数:

查看详情

DeprecationWarning: current URL string parser is deprecated解决方法

我最近在使用mongoDB的时候,发现了这个警告语句,纳闷了,按照官方文档的教程去连接数据库还能出错,也是醉了。 后来尝试去阅读相关资料,发现只是需要将{ useNewUrlParser: true }传入到connect方法中即可: 就不会显示那烦人的警告了,快乐编程。 ...

Wed Mar 27 23:16:00 CST 2019 0 944
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM