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 above result, mycollection is missing....

No comments:

Post a Comment

PostgreSQL-Query: Sort result set by specific field values using ORDER BY Clause

Problem: Suppose we have a book_inventory table which has some columns such as id, isbn, title, author, publisher, publish_date, etc.. whe...