Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.1K
Vistas
MongoDB - couldn't connect to server 127.0.0.1:27017, caused by :Connection refused : connect@src/mongo/shell/mongo.js:374:17

I installed mongodb with homebrew and i use Mac OS Big Sur when I start mongo db with

$ brew services start mongodb-community

It says that mongodb it successfully started but when i run

$ brew services list

The status of mongodb-community is "error" and if I try to type the command "mongo" in the cmd it gave me the problem explained in the title of this question:

MongoDB shell version v4.4.3
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

I ran the following in command line to fix the problem.

mongod --dbpath /usr/local/var/mongodb

this was directly after a re-install.

The error message that clued me in was:

{"t":{"$date":"2021-04-22T11:33:48.608-04:00"},"s":"E", "c":"STORAGE", "id":20557, "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"NonExistentPath: Data directory /data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file."}}

more specifically

"error":"NonExistentPath: Data directory /data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file."

over 4 years ago · Santiago Trujillo Denunciar

0

-Archlinux

Search for [.mongodb / mongosh /]

Give execute permission to config.

over 4 years ago · Santiago Trujillo Denunciar

0

if you want to run mongodb type on terminal:

mongod --dbpath /usr/local/var/mongodb

If it not works use only:

mongod

And if you want to make CRUD in your db via SHELL or TERMINAL, run this :

mongo

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda