Drop Collection in MongoDB




Syntax:
Db.collection-Name.drop();

Example:

>use mydb
switched to db mydb
>show collections
mycol
mycollection

Now drop collection by name,
>db.mycollection.drop()
true

Again check the list

>show collections
mycol

See the above result, mycollection is missing...

No comments:

Post a Comment

Please do not enter any spam link in the comment box.

Related Posts

What is the Use of isNaN Function in JavaScript? A Comprehensive Explanation for Effective Input Validation

In the world of JavaScript, input validation is a critical aspect of ensuring that user-provided data is processed correctly. One indispensa...