- Reference >
- Database Commands >
- Administration Commands >
- drop
drop¶
On this page
-
drop
¶ The
drop
command 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
drop
command. Omit to use the default write concern.When issued on a sharded cluster,
mongos
converts the write concern of thedrop
command and its helperdb.collection.drop()
to"majority"
.The
mongo
shell 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.