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.
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
Generated with the Darkfish Rdoc Generator 2.