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

305
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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