Method: Mongoid::Config#purge!

Defined in:
lib/mongoid/config.rb

#purge!true

Note:

This is the fastest way to drop all data.

Purge all data in all collections, including indexes.

Examples:

Purge all data.

Mongoid::Config.purge!

Returns:

  • (true)

    true.

Since:

  • 2.0.2



171
172
173
174
175
# File 'lib/mongoid/config.rb', line 171

def purge!
  Sessions.default.collections.each do |collection|
    collection.drop
  end and true
end

Comments