This is the error which is still being thrown when saving even after adding native promise.
(node:5604) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html
mongoose.Promise = global.Promise;
mongoose.connect('mongodb://127.0.0.1/optimusCP')
.then(function () {
console.log('Connected to MONGOD !!');
}).catch(function (err) {
console.log('Failed to establish connection with MONGOD !!');
console.log(err.message);
});
I have tried both bluebird & q, still haven't found a fix for this. Below is the code when I save this, the following deprecation warning shows up..
var user = new User();
user.email = req.body.email;
user.password = hash;
user.save()
.then(function (user) {
console.log(user);
})
.catch(function (err) {
console.log(err);
});
This error is happening on the new version of mongoose which is 4.8.1, but working fine on 4.7.6 mongoose version.