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

219
Vistas
how to connect another machine mongodb database inside local network ?

I follow this mongoose document enter link description here

mongoose.connect('mongodb://localhost/waterDB');

Using This, I can connect local machine waterDBmongoDB DataBase

My Personal Machine Local IP : 192.168.1.5

My Server Machine Local IP : 192.168.1.100

Both machine have waterDB DataBase . There is no username and password for both DB

I wanted to connect Server Machine waterDB Inside My Personal Machine.

According To This : mongoose.connect('mongodb://username:password@host:port/database?options...');

I try : mongoose.connect('mongodb://192.168.1.100:27017/waterDB');

But,

MongoError: failed to connect to server [192.168.1.100:27017] on first connect
at null.<anonymous> (/home/water/node_modules/mongodb-core/lib/topologies/server.js:313:35)
at emitOne (events.js:77:13)
at emit (events.js:169:7)
..........

Any solution for err ?

Thank (@_@)

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

It might be a problem with your MongoDB instance listening on localhost only. You can change the bind address in MongoDB's configuration file. The config file may be located in /etc/mongodb.conf or /etc/mongod.conf. There are also 2 config file formats:

Old format (still supported):

bind_ip = 0.0.0.0

YAML (version 2.6+):

net:
    bindIp: 0.0.0.0

After changing the config file you have to restart the MongoDB server.

over 4 years ago · Santiago Trujillo Denunciar

0

Try without the Port no.

mongoose.connect('mongodb://192.168.1.100/waterDB');

this should work for you.

But make sure both are connected on the same network, if you are connected on other network than your server is, then it wont work

over 4 years ago · Santiago Trujillo Denunciar

0

You will have to use SSH tunnel in this case. Refer to the following link which shows how you can create SSH tunnel.
Node.js SSH Tunneling to MongoDB using Mongoose

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