module Mongoid::Persistable::Destroyable::ClassMethods
Public Instance Methods
destroy_all(conditions = nil)
click to toggle source
Delete all documents given the supplied conditions. If no conditions are passed, the entire collection will be dropped for performance benefits. Fires the destroy callbacks if conditions were passed.
@example Destroy matching documents from the collection.
Person.destroy_all({ :title => "Sir" })
@example Destroy all documents from the collection.
Person.destroy_all
@param [ Hash ] conditions Optional conditions to destroy by.
@return [ Integer ] The number of documents destroyed.
@since 1.0.0
# File lib/mongoid/persistable/destroyable.rb, line 58 def destroy_all(conditions = nil) where(conditions || {}).destroy end