关于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:27017/study", {useNewUrlParser:true}, function(err){
if(err){
console.log('Connection Error:' + err)
}else{
console.log('Connection success!') }
})
本文讨论了NodeJS中使用旧版URL解析器连接MongoDB时出现的DeprecationWarning警告,并提供了更新的连接选项以避免此警告,确保使用新解析器进行数据库连接。
390

被折叠的 条评论
为什么被折叠?



