Sha256: fd26242de1c8860a3fbfe7ace0174e61d9f2f3ec5f5d03c368e0d6c43095e06b

Contents?: true

Size: 647 Bytes

Versions: 13

Compression:

Stored size: 647 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Commands
    class DeleteAll
      # 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:
      #
      # <tt>DeleteAll.execute(Person, :conditions => { :field => "value" })</tt>
      def self.execute(klass, params = nil)
        params ? klass.find(:all, params).each do
          |doc| Delete.execute(doc)
        end : klass.collection.drop
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mongoid-0.10.5 lib/mongoid/commands/delete_all.rb
mongoid-0.10.4 lib/mongoid/commands/delete_all.rb
mongoid-0.10.3 lib/mongoid/commands/delete_all.rb
mongoid-0.10.2 lib/mongoid/commands/delete_all.rb
mongoid-0.10.1 lib/mongoid/commands/delete_all.rb
mongoid-0.10.0 lib/mongoid/commands/delete_all.rb
mongoid-0.9.12 lib/mongoid/commands/delete_all.rb
mongoid-0.9.11 lib/mongoid/commands/delete_all.rb
mongoid-0.9.10 lib/mongoid/commands/delete_all.rb
mongoid-0.9.9 lib/mongoid/commands/delete_all.rb
mongoid-0.9.8 lib/mongoid/commands/delete_all.rb
mongoid-0.9.7 lib/mongoid/commands/delete_all.rb
mongoid-0.9.6 lib/mongoid/commands/delete_all.rb