Mongo Bulk Update


So I have some client-side code that will need to make Updates to an array of Documents. Currently, I loop through the Documents on the client-side and then call a server-side Method to actually perform the Collection.Update calls.

Performing the DB hits seems very wrong. I started off creating a new Method to to take in an array of the _ids that have to be changed and then doing a Collection.Update({_id: ARR_IDS}, { $set: {SOMETHING}) . But then I realized that every item in the $set has to be respective to whatever item in the array is changing.

How can I handle a bulk update? Or, provided my list of Documents is only ~100 - is it not terrible to just leave the update calls in the for loop?


What exactly are you setting?

Please see my more detailed post Foo.$[].bar is not allowed by the Schema