(node:3341) DeprecationWarning: Mongoose: mpromise

后端 未结 8 1878
忘了有多久
忘了有多久 2020-11-27 11:19

I\'m trying to develop a class on the top of the mongoose with my custom methods, so I extended the mongoose with my own class but when I invoke to create a new car method i

8条回答
  •  我在风中等你
    2020-11-27 11:50

    var mydb;
    var uri = 'mongodb://localhost/user1';
    var promise = mongooose.connect(uri,{
          useMongoClient: true,
    });
    promise.openUri(uri,function(errr,db){
    if(errr){
            throw errr;
          }else{
            console.log("Connection Successfull");      
            mydb = db;
          }
    });
    

    One needs to have connection with the help of promise in the latest version of mongoose [this is the link][1] [1]: http://mongoosejs.com/docs/promises.html

提交回复
热议问题