WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

MongoDB - Drop Collection



MongoDB - Drop Collection how to drop a collection using MongoDB.

The drop() Method

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

Syntax

There are following Basic syntax of drop() command
db.COLLECTION_NAME.drop()

Example

First, check the available collections into your database mydb.
>use mydb
switched to db mydb
>show collections
mycol
mycollection
system.indexes
welookups
>
Now drop the collection with the name mycollection.
>db.mycollection.drop()
true
>
Again check the list of collections into database.
>show collections
mycol
system.indexes
welookups
>
drop() method will return true, if the selected collection is dropped successfully, otherwise it will return false.




Welookups is optimized for learning.Copy right 2018 kumar aditya singh .
All Right Reserved and you agree to have read and accepted our term and condition.
All Rights Reserved.