0👍
You’re using a .then(...).catch(...)
function with mongoose which it doesn’t support by default. The safe way to use Promises with mongoose is by passing a global Promise.
const mongoose = require('mongoose');
const url = 'mongodb://localhost:27017/dev6'
mongoose.Promise = global.Promise;
connect = () =>{
mongoose.connect(url, { useNewUrlParser: true }).then(console.log('Database Connected')).catch(err => {console.log(err)});
}
...
...
I hope this helps you.
- [Vuejs]-How can I insert or update a js-timestamp component after the page has loaded?
- [Vuejs]-Vuex: Accessing state from anther module inside different module getter
0👍
I had a similar problem. Was using
let mongoose = require("mongoose");
As soon as I switched to
const mongoose = require("mongoose");
problem solved.
- [Vuejs]-How to dynamically insert a template into another template
- [Vuejs]-Integrating a widget in nuxtjs
Source:stackexchange.com