- Reference >
- mongo Shell Methods >
- Collection Methods >
- db.collection.drop()
db.collection.drop()¶
On this page
Definition¶
- db.collection.drop()¶
Removes a collection from the database. The method also removes any indexes associated with the dropped collection. The method provides a wrapper around the drop command.
db.collection.drop() has the form:
db.collection.drop()
db.collection.drop() takes no arguments and will produce an error if called with any arguments.
Returns: - true when successfully drops a collection.
- false when collection to drop does not exist.
Behavior¶
This method obtains a write lock on the affected database and will block other operations until it has completed.
Example¶
The following operation drops the students collection in the current database.
db.students.drop()