@attribute [r] criteria The criteria for the context. @attribute [r] options The command options. @attribute [r] update The updates. @attribute [r] query The Moped query.
@attribute [r] criteria The criteria for the context. @attribute [r] options The command options. @attribute [r] update The updates. @attribute [r] query The Moped query.
@attribute [r] criteria The criteria for the context. @attribute [r] options The command options. @attribute [r] update The updates. @attribute [r] query The Moped query.
@attribute [r] criteria The criteria for the context. @attribute [r] options The command options. @attribute [r] update The updates. @attribute [r] query The Moped query.
Initialize the find and modify command, used for MongoDB's $findAndModify.
@example Initialize the command.
FindAndModify.new(criteria, { "$set" => { likes: 1 }})
@param [ Criteria ] criteria The criteria. @param [ Hash ] update The updates. @param [ Hash ] options The command options.
@option options [ true, false ] :new Return the updated document. @option options [ true, false ] :remove Delete the first document. @option options [ true, false ] :upsert Create the document if it doesn't exist.
@since 3.0.0
# File lib/mongoid/contextual/find_and_modify.rb, line 27 def initialize(collection, criteria, update, options = {}) @collection, @criteria, @options, @update = collection, criteria, options, update.mongoize @query = collection.find(criteria.selector) apply_criteria_options end
Generated with the Darkfish Rdoc Generator 2.