Method: Mongoid::Atomic#atomic_pulls

Defined in:
lib/mongoid/atomic.rb

#atomic_pullsArray<Hash>

Get all the attributes that need to be pulled.

Examples:

Get the pulls.

person.atomic_pulls

Returns:

  • (Array<Hash>)

    The $pullAll operations.

Since:

  • 2.2.0



203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/mongoid/atomic.rb', line 203

def atomic_pulls
  pulls = {}
  delayed_atomic_pulls.each_pair do |_, docs|
    path = nil
    ids = docs.map do |doc|
      path ||= doc.flag_as_destroyed
      doc._id
    end
    pulls[path] = { "_id" => { "$in" => ids }} and path = nil
  end
  pulls
end