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

125
Vistas
Limit number of mongodb documents inserted at the same time

I am using find to query and then insert almost 1000 documents in a mongodb collection.Is there a way to limit the number of documents being inserted at the same time.(My basic objective here is to find all documents with a particular year from a collection and then copy/insert them within the same collection with updated year and few other sections.The problem is when this API is in progress other API's gets a delay.So I need to change the concurrency rate at which these happens).

async function Options(fromYear,toYear){
await db.collection('Options').find({"year":parseInt(fromYear)}).forEach(function(doc){
    var newDoc = doc;
    delete newDoc._id;
    newDoc.year = parseInt(toYear);
    db.collection('Options').insert(newDoc);
    });
}
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