0

After a few days of developing using Nodejs and MongoDB today I'm getting this error when I want to get into the first page of my app:

MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017

enter image description here

And when I try to connect to db using mongodb compass:

enter image description here

Sara Ree
  • 3,417
  • 12
  • 48
  • Does this answer your question? [ECONNREFUSED error when connecting to mongodb from node.js](https://stackoverflow.com/questions/20386464/econnrefused-error-when-connecting-to-mongodb-from-node-js) – Robert Harvey Aug 10 '21 at 18:32

2 Answers2

1

Have you verified if mongo is running in the background? Run mongod in the terminal and see the response, maybe your mongo process is'nt running and then you cant connect to your local mongodb.

1

I had the same issue and I fixed it. Go to Services -> search for "MongoDB Server". Right Click on it and then Click on Start.

enter image description here

Sabbir
  • 1,374
  • 1
  • 15
  • 23