You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#db defaults to the default Mongoid database, but can be specified manually in a few ways:
querying DatabaseCleaner[:mongoid].db returns :default, however I do not have a database called default, yet DatabaseCleaner works as expected. I do have a Mongoid client configured via mongoid.yml called default, though.
When attempting to tell DatabaseCleaner to clean database that is referenced via a differently named client, I need to supply the other clients name to DatabaseCleaner[:mongoid].db instead of the actual databases name for things to work as expected. Specifying DatabaseCleaner[:mongoid, db: :actual_database_name].start and ...clean does not work.
So it seems that the #db method is a misnomer and instead accesses Mongoid.clients[DatabaseCleaner[:mongoid].db] to resolve the actual clients/databases to clean (deduced from observed behavior, I didn't check in the code).
Could you please clarify what the actual configuration should be? Also, is it possible to have DatabaseCleaner handle multiple databases/clients/sessions at once, and if so, how would that be configured?
The text was updated successfully, but these errors were encountered:
The README states
querying
DatabaseCleaner[:mongoid].db
returns:default
, however I do not have a database called default, yet DatabaseCleaner works as expected. I do have a Mongoid client configured viamongoid.yml
calleddefault
, though.When attempting to tell DatabaseCleaner to clean database that is referenced via a differently named client, I need to supply the other clients name to DatabaseCleaner[:mongoid].db instead of the actual databases name for things to work as expected. Specifying
DatabaseCleaner[:mongoid, db: :actual_database_name].start
and...clean
does not work.So it seems that the
#db
method is a misnomer and instead accessesMongoid.clients[DatabaseCleaner[:mongoid].db]
to resolve the actual clients/databases to clean (deduced from observed behavior, I didn't check in the code).Could you please clarify what the actual configuration should be? Also, is it possible to have DatabaseCleaner handle multiple databases/clients/sessions at once, and if so, how would that be configured?
The text was updated successfully, but these errors were encountered: