Class Mongoid::Relations::Embedded::Atomic::Operation
In: lib/mongoid/relations/embedded/atomic/operation.rb
Parent: Object

Methods

consume   consumed?   execute  

Attributes

documents  [RW] 
options  [RW] 
path  [RW] 
selector  [RW] 

Public Instance methods

Consumes an execution that was supposed to hit the database, but is now being deferred to later in favor of a single update.

@example Consume the operation.

  set.consume(
    { "_id" => BSON::ObjectId.new },
    { "$push" => { "addresses" => { "_id" => "street" } } },
    { :multi => false, :safe => true }
  )

@param [ Hash ] selector The document selector. @param [ Hash ] operations The ops to set in the db. @param [ Hash ] options The persistence options.

@option options [ true, false ] :multi Persist multiple at once. @option options [ true, false ] :safe Persist in safe mode.

@since 2.0.0

Has this operation consumed any executions?

@example Is this consumed?

  unset.consumed?

@return [ true, false ] If the operation has consumed anything.

@since 2.0.0

Execute the $pushAll operation on the collection.

@example Execute the operation.

  unset.execute(collection)

@param [ Collection ] collection The root collection.

@since 2.0.0

[Validate]