node.js与mongoDB连接 error,current URL string parser is deprecated

(node:9388) 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.

solved:

	mongoose.connect('mongodb://tiankun:[email protected]:11143/nodeexpress',{useNewUrlParser:true}, function(err){

    if(err){

        console.log('Connection Error:' + err)

    }else{

        console.log('Connection success!') }

});

Related Posts