removes dropping of mongo indexes, see url below for more info

9323d6c3a0
This commit is contained in:
Ben Mabey 2011-02-04 08:51:39 -07:00
parent 8094293085
commit 8c13f57a7a
2 changed files with 6 additions and 8 deletions

View file

@ -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

View file

@ -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/ }