如果在调用数据库的时候出现: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. 的正确解决方法如下:
添加 {useNewUrlParser:true}。
MongoClient.connect(Config.dbUrl,{useNewUrlParser:true},(err,client)=>{
if(err){
reject(err)
}else{
_that.dbClient=client.db(Config.dbName);
resolve(_that.dbClient)
}
})