lib/mongoid/persistence.rb
# Delete all documents given the supplied conditions. If no conditions
# are passed, the entire collection will be dropped for performance
# benefits. Does not fire any callbacks.
#
# @example Delete matching documents from the collection.
#   Person.delete_all(:conditions => { :title => "Sir" })
#
# @example Delete all documents from the collection.
#   Person.delete_all
#
# @param [ Hash ] conditions Optional conditions to delete by.
#
# @return [ Integer ] The number of documents deleted.
Delete all documents given the supplied conditions. If no conditions
are passed, the entire collection will be dropped for performance
benefits. Does not fire any callbacks.
Delete all documents given the supplied conditions . If no conditions are passed the entire collection will be dropped for performance benefits . Does not fire any callbacks .
def delete_all(conditions = nil)
        conds = conditions || {}
        selector = conds[:conditions] || conds
        selector.merge!(_type: name) if hereditary?
        coll = collection
        deleted = coll.find(selector).count
        coll.find(selector).remove_all
        Threaded.clear_options!
        deleted
      end
def delete_all ( conditions = nil ) conds = conditions || { } selector = conds [ :conditions ] || conds selector . merge! ( _type : name ) if hereditary? coll = collection deleted = coll . find ( selector ) . count coll . find ( selector ) . remove_all Threaded . clear_options! deleted end
Delete all documents given the supplied conditions.
Delete all documents given the supplied conditions .
The number of documents deleted.
The number of documents deleted .
 Integer 
conditions
<not_specific>
<not_specific>
conditions Optional conditions to delete by.
conditions Optional conditions to delete by .
example
Delete matching documents from the collection. Person.delete_all(:conditions => { :title => "Sir" })
Delete matching documents from the collection . Person . delete_all ( : conditions = > { : title = > " Sir " } )
example
Delete all documents from the collection. Person.delete_all
Delete all documents from the collection . Person . delete_all