Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

315
Views
¿Cómo volver a conectarse automáticamente a mongodb después de la pérdida de conexión?

Estoy tratando de averiguar cómo puedo hacer que mi aplicación nodejs/express se vuelva a conectar automáticamente a mongodb después de una pérdida de conexión. Me di cuenta de que mi aplicación pierde la conexión cuando pausa/detengo mi clúster mongodb y nunca me vuelvo a conectar, incluso cuando habilito el clúster. Por lo tanto, necesito reiniciar manualmente mi aplicación para volver a conectarme a mongodb. No es ideal para un entorno de producción.

Después de algunas investigaciones, he intentado configurar mi conexión de esta manera:

 const options = { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true, useFindAndModify: false, autoIndex: true, autoReconnect:true, reconnectTries: Number.MAX_VALUE, reconnectInterval: 500, bufferMaxEntries: 0, connectTimeoutMS: 10000, socketTimeoutMS: 45000, } mongoose.connect(MONGO_URI, options);

Pero me sale los siguientes errores:

 (node:21749) DeprecationWarning: The option `autoReconnect` is incompatible with the unified topology, please read more by visiting http://bit. ly/2D8WfT6 ... (node:21749) DeprecationWarning: The option `reconnectTries` is incompatible with the unified topology, please read more by visiting http://bit. ly/2D8WfT6 ... (node:21749) DeprecationWarning: The option `reconnectInterval` is incompatible with the unified topology, please read more by visiting http://bit. ly/2D8WfT6

Cualquier sugerencia ?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!