Class: Mongoid::Persistence::Operations::Remove
- Includes:
- Deletion, Mongoid::Persistence::Operations
- Defined in:
- lib/mongoid/persistence/operations/remove.rb
Overview
Remove is a persistence command responsible for deleting a document from the database.
The underlying query resembles the following MongoDB query:
collection.remove(
{ "_id" : 1 },
false
);
Instance Attribute Summary
Attributes included from Mongoid::Persistence::Operations
Instance Method Summary collapse
-
#persist ⇒ true
Remove the document from the database: delegates to the MongoDB collection remove method.
Methods included from Deletion
Methods included from Mongoid::Persistence::Operations
#collection, #deletes, #initialize, insert, #inserts, #notifying_parent?, #options, #parent, remove, #selector, update, #updates, #validating?
Instance Method Details
#persist ⇒ true
Remove the document from the database: delegates to the MongoDB collection remove method.
25 26 27 28 29 |
# File 'lib/mongoid/persistence/operations/remove.rb', line 25 def persist prepare do |doc| collection.remove({ :_id => doc.id }, ) end end |