Module: DatabaseCleaner::Mongo2::TruncationMixin

Included in:
DatabaseCleaner::Mongoid::Truncation
Defined in:
lib/database_cleaner/mongo2/truncation_mixin.rb

Instance Method Summary collapse

Instance Method Details

#cleanObject



5
6
7
8
9
10
11
12
# File 'lib/database_cleaner/mongo2/truncation_mixin.rb', line 5

def clean
  if @only
    collections.each { |c| database[c].find.delete_many if @only.include?(c) }
  else
    collections.each { |c| database[c].find.delete_many unless @tables_to_exclude.include?(c) }
  end
  true
end