mongoose的 useNewUrlParser 警告解决办法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36940798/article/details/84649443

报错信息如下

     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://127.0.0.1:27017/admin', { useNewUrlParser: true })

猜你喜欢

转载自blog.csdn.net/qq_36940798/article/details/84649443