LoginSignup

MongoError: connect ECONNREFUSED 127.0.0.1:27017

Asked 9 days agoAnswer 0Votes 0

0

195

I'm using NodeJS wih MongoDB using mongodb package. When I run mongod command it works fine and gives "waiting for connection on port 27017". So, mongod seems to be working. But MongoClient does not work and gives error when I run node index.js command-

MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]

MongoError: connect ECONNREFUSED 127.0.0.1:27017


0 Answers


Your Answer