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

770
Visualizações
"MongoServerSelectionError: connection <monitor> to xxx.xx.xx.xxx:27017 closed

I am using AWS DocumentDB as my database in my application which is developed in node.js which is MongoDB compatible. I have used MongoClient to connect to my database. My application executes but it makes approx 1000 DB connections for each execution and then it fails with an error:

MongoServerSelectionError: connection <monitor> to xxx.xx.xx.xxx:27017 closed. 

I tried to use client.close() as well to close the connections then it gave that the connection pool is closed. I believe that issue is due to so many database connections.

How can I release the connections in MongoDB? Any help is appreciated.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

It appears from your question that what is happening is that you are defining a new MongoClient object each time you invoke your function resulting in the driver creating a new database connection with each function call. Instead, define the client connection outside the AWS Lambda handler function and reuse the connection with each function call.

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