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

280
Views
¿Cómo puedo actualizar los valores de un documento, donde el documento es una matriz?

¿Cómo puedo actualizar los valores de un documento, donde el documento es una matriz?

db.get().collection(colección.CATEGORY_OFFER).insertOne(data).then(async(response)=>{ let product = await db.get().collection(collection.PRODUCT_COLLECTION).find({Category:catName }).toArray() console.log(producto) var bulkOp = db.get().collection(colección.PRODUCT_COLLECTION).initializeOrderedBulkOp();

 var count = 0; db.get().collection(collection.PRODUCT_COLLECTION).find().forEach(function(doc){ console.log("first") console.log(catName) console.log(catOffer) console.log(parseInt(doc.Prize)-parseInt(doc.Prize*catOffer/100)) bulkOp.find({Category:catName}).updateOne({ $set:{ offer:true, oldPrize:parseInt(doc.Prize), value:catOffer, Prize:(parseInt(doc.Prize)-parseInt(doc.Prize*catOffer/100)).toFixed(0) } }) count++; if(count % product.length === 0){ console.log("second") console.log(product.length) bulkOp.execute(); bulkOp =db.get().collection(collection.PRODUCT_COLLECTION).initializeOrderedBulkOp(); console.log("helo world") console.log(bulkOp) } }) if(count > 0 ){ console.log("third") bulkOp.execute(); } console.log("fifth") console.log(bulkOp) console.log(product) })
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!