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

176
Vistas
nodejs crashing on losing connection to mongodb

When i try to restart mongodb service from services.msc, nodejs server is crashing with this error: enter image description here OR enter image description here

My code looks like this

_client = await MongoClient.connect(this._config.connectionString, {
          useNewUrlParser: true,
          useUnifiedTopology: true,
          reconnectTries: 60,
          reconnectInterval: 1000,
          keepAlive: true,
          autoReconnect: true,
        });

What ever i do, im not able to catch this exception there fore my node server is crashing. Is there a way to catch this reliably? To answer a question, why i'm trying this scenario: Sometimes our deployed server is losing connection(to mongoDB) in the cloud and ending up crashing and kick starting new pod in aks.

I'm using mongodb driver, not mongoose.

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

0

You can pass autoReconnect : false as one of the options in configuration. Documentation link

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