Class: Mongoid::Commands::DeleteAll

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/commands/delete_all.rb

Class Method Summary collapse

Class Method Details

.execute(klass, params) ⇒ Object

Performs a delete of the all the Documents that match the criteria supplied.

Options:

params: A set of conditions to find the Documents by. klass: The class of the Document to execute the find on.

Example:

DeleteAll.execute(Person, :conditions => { :field => "value" })



15
16
17
# File 'lib/mongoid/commands/delete_all.rb', line 15

def self.execute(klass, params)
  klass.find(:all, params).each { |doc| Delete.execute(doc) }
end