I've an issue trying to connect with my database. Already tried the following solutions that I found on google:
- restarting MongoDB service on Mac
- manually open db with cmd located on bin file of MongoDB
It seems Mongodb is running - as it's connected in VS and Mongodb Compass. But I can't figure out the issue. Can anyone help me? Thanks :)
const express = require('express')
const app = express()
const mongoose = require('mongoose')
mongoose.connect('mongodb://localhost/subscribers')
const db = mongoose.connection
db.on('error', (error) => console.error(error))
db.once('open', () => console.log('Connected to Database'))
app.listen(3000, () => console.log('Server Started'))