mongoose 连接数据库报错

报错信息如下

     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.

大意就是说:当前的URL字符串解析器被弃用然后也提供了解决方案 让你在选项里面{useNewUrlParser: true}

代码如下:

mongoose.connect('mongodb://user:[email protected]:port/dbname', { useNewUrlParser: true })
  
  

报错信息如下

猜你喜欢

转载自blog.csdn.net/weixin_42422878/article/details/87894416