I'm passing the URL into the function to connect to mlab
.
This is my function :
function connectToDb(mongoURL) {
mongoose.Promise = global.Promise;
mongoose.connect(mongoURL, (err, db) => {
err ? console.log(err) : console.log('Connected mongoose');
});
}
I call the function connectToDb in another function :
function getURL(){
connectToDb(mongoURL);
}
ERROR :
(node:1380) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoo