I am using Mongoose with my Node.js app and this is my configuration:
mongoose.connect(process.env.MONGO_URI, {
useNewUrlParser: true,
useUnifiedTopol
I was also facing the same issue:
I made sure to be connected to mongoDB by running the following on the terminal:
brew services start mongodb-community@4.2
And I got the output:
Successfully started `mongodb-community`
Instructions for installing mongodb at
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
or https://www.youtube.com/watch?v=IGIcrMTtjoU
My configuration was as follows:
mongoose.connect(config.mongo_uri, {
useUnifiedTopology: true,
useNewUrlParser: true})
.then(() => console.log("Connected to Database"))
.catch(err => console.error("An error has occured", err));
Which solved my problem!