Method: Mongoid::Atomic::Modifiers#add_to_set
- Defined in:
- lib/mongoid/atomic/modifiers.rb
permalink #add_to_set(modifications) ⇒ Object
Add the atomic $addToSet modifiers to the hash.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mongoid/atomic/modifiers.rb', line 17 def add_to_set(modifications) modifications.each_pair do |field, value| if add_to_sets.has_key?(field) value.each do |val| add_to_sets[field]["$each"].push(val) end else add_to_sets[field] = { "$each" => value } end end end |