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

126
Visualizações
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 à 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