Parent

Methods

Class/Module Index [+]

Quicksearch

Mongoid::Persistence::Operations::Upsert

Wraps behaviour for performing upserts in Mongodb. No matter if the document has been modified or not, it will be sent to the db and Mongo will determin whether or not to insert or update.

Public Instance Methods

persist() click to toggle source

Persist the upsert operation.

@example Execute the upsert.

operation.persist

@return [ true ] Always true.

@since 3.0.0

# File lib/mongoid/persistence/operations/upsert.rb, line 19
def persist
  prepare do
    collection.find(selector).update(document.as_document, [ :upsert ])
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.