Vamshidhar Behara
Vamshidhar Behara

Reputation: 521

How to drop a specific database using Mongoid?

Mongoid.default_session.database_names gives me an array of database names. I want to delete a specific database. How would I do that?

Mongoid.default_session.drop() always seems to drop the default database even if I override the current database using Mongoid.override_database("test_database")

What am I missing?

Upvotes: 1

Views: 2433

Answers (2)

Sergey Makridenkov
Sergey Makridenkov

Reputation: 624

In Mongoid v2.0.2

Mongoid.purge!

Rdoc: Mongoid.purge!

Upvotes: 3

shelman
shelman

Reputation: 2699

Have you tried a combination of Session.use and Session.drop?

Examples: http://mongoid.org/en/moped/docs/driver.html

Upvotes: 0

Related Questions