Class: Mongoid::Persistence::RemoveAll

Inherits:
Command show all
Defined in:
lib/mongoid/persistence/remove_all.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(
  { "field" : value },
  false
);

Instance Attribute Summary

Attributes inherited from Command

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

Instance Method Summary collapse

Methods inherited from Command

#initialize

Methods included from Safe

#safe_mode?

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.



26
27
28
# File 'lib/mongoid/persistence/remove_all.rb', line 26

def persist
  remove
end