Guess what this does?
Book.delete_all(:title => "The Great Gatsby")
A quick check for :conditions would be appreciated. Apparently I'm not the only one to encounter this issue:
http://www.themomorohoax.com/2010/10/27/mongoids-delete-all-is-way-too-epic
Here's my amusing workaround, for posterity:
module Mongoid module Persistence module ClassMethods alias :delete_all_old :delete_all def delete_all(conditions = nil) selector = (conditions || {})[:conditions] || {} selector.merge!(:_type => name) if hereditary? if collection.find(selector).count == collection.count raise "Are you crazy?!?! Did you forget :conditions?" end delete_all_old(conditions) end end end end