This warning appears on the console:
(node: 5627) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: link
I tried everything so that it does not appear anymore. Does anyone know how to fix it?
var express = require('express');
var bodyParser = require('body-parser');
var assert = require('assert');
var User = require("./models/user").User;
var app = express();
app.use("/estatico", express.static('public'));
app.use(bodyParser.json()); //para peticiones application/json
app.use(bodyParser.urlencoded({extended: true}));
app.set("view engine", "jade");
app.get('/', function(req, res){
res.render("index");
});
app.get('/login', function(req, res){
User.find(function(err,doc) {
console.log(doc);
res.render("login");
})
});
app.post('/users', function(req, res){
var user_login = new User({email: req.body.email,
password: req.body.password,
password_confirmation: req.body.password_confirmation,
username: req.body.username
});
promise = user_login.save();
console.log(assert.ok(promise instanceof require('mpromise')));
return promise.then(function(us) {
res.send("Datos guardados")
},function(err) {
if(err) {
console.log(String(err));
res.send("Los datos no han sido guardados")
};
})
});
app.listen(8080);
The code works, saves the data in case the form is completed correctly and throws the errors in case the form is not completed correctly, but why the warning?