diff --git a/History.txt b/History.txt index 89232ca..14075b8 100644 --- a/History.txt +++ b/History.txt @@ -1,5 +1,8 @@ == 0.6.2 (in git) + === Bugfixes + * Reversed GH-41 after larger community discussion. Mongo indexes are no longer dropped. (Ben Mabey) + == 0.6.1 2011-01-27 === New Features diff --git a/lib/database_cleaner/mongo/truncation.rb b/lib/database_cleaner/mongo/truncation.rb index c6f781b..f9aa1a6 100644 --- a/lib/database_cleaner/mongo/truncation.rb +++ b/lib/database_cleaner/mongo/truncation.rb @@ -1,22 +1,17 @@ module DatabaseCleaner module Mongo module Truncation - + def clean if @only - collections.each { |c| remove(c) if @only.include?(c.name) } + collections.each { |c| c.remove if @only.include?(c.name) } else - collections.each { |c| remove(c) unless @tables_to_exclude.include?(c.name) } + collections.each { |c| c.remove unless @tables_to_exclude.include?(c.name) } end true end private - - def remove(collection) - collection.drop_indexes - collection.remove - end def collections database.collections.select { |c| c.name !~ /^system/ }