Class: Mongoid::Persistence::Remove

Inherits:
Command show all
Defined in:
lib/mongoid/persistence/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 inherited from Command

#collection, #document, #klass, #options, #selector, #validate

Instance Method Summary collapse

Methods inherited from Command

#initialize

Constructor Details

This class inherits a constructor from Mongoid::Persistence::Command

Instance Method Details

#persistObject

Remove the document from the database: delegates to the MongoDB collection remove method.

Example:

Remove.persist

Returns:

true if success, false if not.



24
25
26
# File 'lib/mongoid/persistence/remove.rb', line 24

def persist
  remove
end