Class: Mongoid::Relations::Embedded::Atomic::Pull

Inherits:
Operation show all
Defined in:
lib/mongoid/relations/embedded/atomic/pull.rb

Instance Attribute Summary

Attributes inherited from Operation

#documents, #options, #path, #selector

Instance Method Summary collapse

Methods inherited from Operation

#consume, #consumed?, #execute

Instance Method Details

#operationsHash

Get the merged operations for the single atomic set.

Examples:

Get the operations

set.operations

Returns:

  • (Hash)

    The pull operations.

Since:

  • 2.0.0



17
18
19
20
21
22
23
24
25
# File 'lib/mongoid/relations/embedded/atomic/pull.rb', line 17

def operations
  { "$pull" =>
    { path =>
      { "_id" =>
        { "$in" => documents.map { |doc| doc["_id"] } }
      }
    }
  }
end