MongoDB Drop Collection - MongoDB

How to drop a collection in MongoDB?

In this chapter, we will explain how to drop a collection using MongoDB.

drop() Method

MongoDB's db.collection.drop() is used for droping a collection from the database.

Syntax

Basic syntax of drop() command is as follows

Example

First, check the available collections into your database mydb.

Ccollection can be dropped with the name mycollection.

Again check the list of collections into database.

drop() method will return true, if the selected collection is dropped successfully, else it will return false.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

MongoDB Topics