[Awesome Ruby Gem] Use database_cleaner-mongoid gem to clear MongoDB database for Mongoid
Database Cleaner Adapter for Mongoid
Clean your Mongoid databases with Database Cleaner.
See https://github.com/DatabaseCleaner/database_cleaner for more information.
Installation
You can install it as a gem:
1 | gem install database_cleaner-mongoid |
or add it into a Gemfile (Bundler):
1 | # Gemfile |
Then, run bundle install
.
1 | bundle install |
Usages
Supported Strategies
The mongoid adapter only has one strategy: the deletion
strategy.
Strategy configuration options
:only
and :excep
t may take a list of collection names:
1 | # Only delete the "users" collection. |
Adapter configuration options
#db defaults to the default Mongoid database, but can be specified manually in a few ways:
1 | # Redis URI string: |