Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

335
Views
¿Cómo comparar la solicitud de API JSON con el documento json existente en MongoDb?

El título de la pregunta se explica por sí mismo. Quiero saber qué diferencias hay en el Documento JSON A que proviene de la solicitud de API y el Documento B JSON que ya está en Mongo DB. Cómo obtener cambios en el nombre de la columna y los datos también. Estoy creando un registro. Por eso lo quiero. .. A continuación se muestra el código de lo que estoy intentando:

Código API de NodeJS//

 function Updatejob(req, res) { return function (jobSchedule) { var obj = new Date(); CompareJSON(req, mongodbjson); return Job.create(req.body).then(.....) }

Ya hay datos en Mongodb antes de actualizar el registro

 { "_id" : ObjectId("586d1032aef194155028e9c7"), "history" : [ { "_id" : ObjectId("586d1032aef194155028e9c4"), "updated_by" : "", "details" : "Job Created", "changetype" : "Created", "datetime" : ISODate("2017-01-04T15:09:38.465Z") } ], "current_status" : "Pending", "time" : 0 }

// SOLICITUD DE ACTUALIZACION DE DATOS

 { "_id" : ObjectId("586d1032aef194155028e9c7"), "history" : [ { "_id" : ObjectId("586d1032aef194155028e9c4"), "updated_by" : "", "details" : "Job Completed", "changetype" : "Completed", "datetime" : ISODate("2017-01-04T15:09:38.465Z") } ], "current_status" : "Completed", "time" : 0 }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puedes usar jsondiffpatch :

 var delta = jsondiffpatch.diff(object1, object2);

Ver:

  • https://www.npmjs.com/package/jsondiffpatch
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!