In your rspec add this:
RSpec.configure do |config| config.after(:suite) do # for MongoMapper db = MongoMapper.database # for Mongoid # db = Mongoid.master # drop the database db.command({dropDatabase:1}) end end
For using mongo directly, you need to access the db object and trigger the command as above.