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

306
Visualizações
get update value after an updateOne()

is it possible to get all updated value/value where there is a diff after a call of updateOne()

 _.each(gameResult, function(gameResult){
    bulk.find({"user" : gameResult.user, "section" : gameResult.section , "code" : gameResult.code}).upsert().updateOne(gameResult);
  })

imagine my value in the db before the update are :

1, 1, 1, 1

gameResult is :

1, 2, 1 , 3

So my db is updated : 1, 2, 1, 3

Is it possible to get all value who are changed, so here how can i get my two object 2 and 3 cause i need it in the code.

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

0

You are looking for findAndModify.

This performs an update while also returning the existing document from the database. By default, this method returns the document before the changes are applied (this behavior can be changed with the new:true option). So you can easily compare the returned document with your local document to find the differences.

Unfortunately findAndModify isn't supported by bulk operations, so you need to do it document-by-document.

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