Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
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 Respostas
Responde à pergunta

0

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

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda