skip to Main Content

I’m getting MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017 when trying to start mongo locally with $ mongosh.

$ mongosh
Current Mongosh Log ID: 636addb4****************
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.5.4
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017

Some details: I killed some process at some point to try to stop mongo so I could run run-rs -v 4.0.0 --shell.

4

Answers


  1. Chosen as BEST ANSWER

    Since I had installed mongo with brew this worked

    $ brew services stop mongodb-community
    $ brew services start mongodb-community
    $ mongosh
    

  2. Mark sure mongod is running.You could start it manually if it is in your system environmental variables path by typing mongod in your terminal

    mongod
    
    Login or Signup to reply.
  3. Faced similar problem than after reinstalling the package helped to solve the problem.

    Login or Signup to reply.
  4. In my case, I had only installed mongosh and not mongodb as well.
    Somehow they are separated are require different installations.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search