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

244
Views
MongoDB "update()" (Update the document of “Reg Rubio” and “Ian Tayao” by adding the “President” to their Reporting file)

I use this codes manually

db.employees.update({Name: "Reg Rubio"}, {$set : {ReportingTo: ["Vice-President", "President"]}})

db.employees.update({Name: "Ian Tayao"}, {$set : {ReportingTo: ["Secretary", "Vice-President", "President"]}}) 

to update my data. Is their other way to to combine this in one function?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

So.. no.. , there is no way to update two separate documents using an 2 different inputs in 1 db call.

To optimize network traffic you can use bulkWrite, this still executes each update separately in the db but it only sends the request over network once, reducing the overhead for all the traffic. This is the only optimization you can add and for only 2 calls I would say it's somewhat negligent.

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!