Method: Mongoid::Atomic::Modifiers#push

Defined in:
lib/mongoid/atomic/modifiers.rb

#push(modifications) ⇒ Object

Adds push modifiers to the modifiers hash.

Examples:

Add push operations.

modifiers.push({ "addresses" => { "street" => "Bond" }})

Parameters:

  • modifications (Hash)

    The push modifiers.

Since:

  • 2.1.0



67
68
69
70
71
72
73
# File 'lib/mongoid/atomic/modifiers.rb', line 67

def push(modifications)
  modifications.each_pair do |field, value|
    push_fields[field] = field
    mods = push_conflict?(field) ? conflicting_pushes : pushes
    add_operation(mods, field, Array.wrap(value))
  end
end