Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongoid3 Cleaner can not remove a collection that contains the "system" in name. #6

Open
sakomoko opened this issue Aug 16, 2012 · 2 comments

Comments

@sakomoko
Copy link

Mongoid3 Cleaner can not remove a collection that contains the "system" in name.
collection name e.g. user_systems, system_settings

Cause
Moped::Truncation.collections

      def collections
        session['system.namespaces'].find(:name => { '$not' => /system|\$/ }).to_a.map do |collection|
          _, name = collection['name'].split('.', 2)
          name
        end
      end

I think. To fix this, change the RegExp.

e.g.
/^system\./

@jfrey
Copy link

jfrey commented Aug 16, 2012

I ran into this as well.

@ekampp
Copy link

ekampp commented Nov 27, 2014

According to this article, all the system collections has something following them, and doesn't start with "system". So perhaps this is a more stable solution?

/\.system\.|\$/

Edit

Exactly like it is in the current master. I think this issue is closed?

@botandrose botandrose transferred this issue from DatabaseCleaner/database_cleaner Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants