OPTIONS

dropDatabase

dropDatabase

The dropDatabase command drops the current database, deleting the associated data files.

Changed in version 2.6: This command does not delete the users associated with the current database. To drop the associated users, run the dropAllUsersFromDatabase command in the database you are deleting.

To run this command, issue the use <database> command in the shell, replacing <database> with the name of the database you wish to delete. Then use the following command form:

{ dropDatabase: 1 }

The mongo shell also provides the following equivalent helper method db.dropDatabase().

Warning

This command obtains a global write lock and will block other operations until it has completed.

←   copydb listCollections  →

Was this page helpful?

Yes No

Thank you for your feedback!

We're sorry! You can Report a Problem to help us improve this page.

ON THIS PAGE