I'm having trouble trying to connect mongodb's localhost to Node. I've tried all kinds of solutions and none of them solve the problem, I honestly don't know what to do anymore. Sorry if I asked the question wrong, I'm new. Attached the error that the console throws me:
I attach my code:
var mongoose = require('mongoose');
mongoose.set('useFindAndModify', false);
mongoose.Promise = global.Promise;
mongoose.connect('mongodb://localhost:27017/portafolio', {useNewUrlParser:true,
useUnifiedTopology: true})
.then(() => {
console.log('Conexion a la base de datos establecida');
});
.catch(err => console.log(err));