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

128
Views
los elementos de la matriz en los datos de la mangosta no se actualizan

mis datos:

 { _id: 123, items: [ { name: "item name", quantity: 1 }, { name: "item name 2", quantity: 1 } ] }

código:

 const doc = await profile.findOne({ _id: 123 }) for (var i = 0 ; i < doc.items.length ; i++) { doc.items[i].quantity += 1 } await doc.save()

Intenté esto pero no actualizó los datos. No estoy usando updateOne porque necesito llamar a esta función como 5-10 veces en un ciclo for, llamar a await profile.updateOne para actualizar la cantidad de cada elemento en la matriz lo hará más lento. Estoy usando mangosta por cierto

about 4 years ago · Juan Pablo Isaza
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!