Updated regexp for filter system collections

Fixed cleaning collections with names like:

favourite_systems
operating_systems
systems

and so on.

All real mongo's system collections have following name format (as in 2.4.1):

  {db_name}.system.{system_collection_type}
This commit is contained in:
Viacheslav Molokov 2014-06-20 16:14:35 +04:00
parent 8d7f72ffc9
commit 1111b7fa9f
1 changed files with 1 additions and 1 deletions

View File

@ -23,7 +23,7 @@ module DatabaseCleaner
session.use(db)
end
session['system.namespaces'].find(:name => { '$not' => /system|\$/ }).to_a.map do |collection|
session['system.namespaces'].find(:name => { '$not' => /\.system\.|\$/ }).to_a.map do |collection|
_, name = collection['name'].split('.', 2)
name
end