0
votes

I am making an app on Node.js and trying to connect to MongoDB via mongoose. When I run it, in cmd it shows "connected to MongoDB database", but this is what it shows when I run mongo. It doesn't say connected Mongo connection status

Also, when I try to connect MongoDB compass to localhost:27017, it shows the error " read ECONNRESET". So clearly, for some reason, my MongoDB is not connected to the localhost. Can someone help me out? here is my mongoose connection code in app.js. App.js Mongoose connection code

2

2 Answers

0
votes

Can you check your mongod.conf file to see the port the server is set to run on.If on linux and running as a service use systemctl status mongod to ensure the process is running. Hope it helps.

0
votes

Maybe you should run the command- " mongod " in another window and check.