关于express 连接 mongodb数据库报错

关于express 连接 mongodb数据库报错

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!')

  }

})

 

上一篇:javascript – 将默认值设置为节点js中的mongoose数组


下一篇:javascript – Express / Mongoose应用程序的结构