MongoDB Drop collection

In MongoDB, db.collection.drop() system is utilized to drop an accumulation from a database. It totally expels an accumulation from the database and does not leave any records connected with the dropped accumulations.

The db.collection.drop() strategy does not take any contention and produce a mistake when it is called with a contention. This system evacuates every one of the records connected with the dropped gathering.

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()

Returns

true when successfully drops a collection.

false when collection to drop does not exist.

MongoDB Drop collection example

The following operation drops the students collection in the current database.

db.students.drop()