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:password@sample.com:port/dbname', { useNewUrlParser: true })
还没有评论,来说两句吧...