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

Not cleaning collections in other Mongo sessions #2

Open
White-Oak opened this issue Sep 9, 2016 · 1 comment
Open

Not cleaning collections in other Mongo sessions #2

White-Oak opened this issue Sep 9, 2016 · 1 comment

Comments

@White-Oak
Copy link

Not sure if this is fixable, but we have a supporting rails app, that looks for its data in a main's app db.
So some models have this code:

class User
    store_in collection: 'users', session: 'main_app'
...

These collections are not cleaned by DatabseCleaner. To fix this we need to use:

  config.after(:each) do
    DatabaseCleaner[:mongoid].clean
    Mongoid.session('main_app').collections.each do |collection|
      collection.drop
    end
  end
@White-Oak
Copy link
Author

White-Oak commented Sep 9, 2016

database_cleaner 1.5.3
mongo 2.6.10

@White-Oak White-Oak changed the title Not cleaning collections in other sessions Not cleaning collections in other Mongo sessions Sep 9, 2016
@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

1 participant