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

1.7K
Views
Cómo actualizar objetos anidados en MongoDb con Mongoose

Estoy tratando de actualizar un valor clave en un objeto anidado en MongoDB. actualmente, de la forma en que lo hago, se sobrescribe todo el objeto anidado, ¿cómo puedo cambiar un par clave-valor?

 try { Files.updateOne( { _id: document._id }, {a:{b:{c:"new text", d: "not to change"}}}, function (err, result) { if (err) { res.send(err); } else { res.send(result); } } ); } catch (err) { res.status(400).send(err); }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Prueba esto:

 try { Files.updateOne( { _id: document._id }, { "abc": "new text" }, function (err, result) { if (err) { res.send(err); } else { res.send(result); } } ); } catch (err) { res.status(400).send(err); }
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!