I'm trying to save myself a lot of queries, I'm using Mongoose as ODM.
I have a rather large array topic_codes, say 50k+ elements, I'm doing this (CoffeeScript):
conditions = code: $in: topic_codes
update = $push: samples: date: point_in_time, volume: ??
options = multi: true
TopicArchive.update conditions, update, options, (err) ->
Here I am trying to insert a new subdocument in 'samples', which is an array, of my document with an object with two attributes, date and volume.
While date is the same for every record I'd like to update, volume it's not and can vary from record to record.
Is there a way to achieve my goal without having to go through a huge database hit?