- Reference >
- Database Commands >
- Administration Commands >
- drop
drop¶
On this page
-
drop¶ The
dropcommand removes an entire collection from a database. The command has following syntax:The command takes the following fields:
Field Description drop The name of the collection to drop. writeConcern Optional. A document expressing the write concern of the
dropcommand. Omit to use the default write concern.When issued on a sharded cluster,
mongosconverts the write concern of thedropcommand and its helperdb.collection.drop()to"majority".The
mongoshell provides the equivalent helper methoddb.collection.drop().
Behavior¶
This command also removes any indexes associated with the dropped collection.
Starting in MongoDB 4.0.2, dropping a collection deletes its associated zone/tag ranges.
Warning
This command obtains a write lock on the affected database and will block other operations until it has completed.
The drop command and its helper
db.collection.drop() create an invalidate Event
for any Change Streams opened on the dropped collection.