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

201
Vistas
Best way to update many documents in a collection in mongo?

Basically, I want to check a schedule field in every document, and if Date.now() falls within the bounds of the schedule, I want to set isActive to true.

{

schedule: {
    start: (Date object),
    end: (Date object)
},
isActive: false

}

That in itself is simple, but my issue is that this collection can potentially have hundreds of thousands of documents. I also need this to run every 30 minutes using cron.

Is there any way to efficiently do this without totally locking up my application and/or database every 30 minutes for however long it takes?

Do I need to call save() on each document individually or is there a way I can save all of them at once?

about 4 years ago · Juan Pablo Isaza
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