MongoDB Drop Collection

📘 Premium Read: Access my best content on Medium member-only articles — deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.

✅ Some premium posts are free to read — no account needed. Follow me on Medium to stay updated and support my writing.

🎓 Top 10 Udemy Courses (Huge Discount): Explore My Udemy Courses — Learn through real-time, project-based development.

▶️ Subscribe to My YouTube Channel (172K+ subscribers): Java Guides on YouTube

In this post, we will see 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

The basic syntax of drop() command is as follows −
db.COLLECTION_NAME.drop()

Example

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

Summary

The below diagram shows the summary of all the commands used in this post:

Comments

Spring Boot 3 Paid Course Published for Free
on my Java Guides YouTube Channel

Subscribe to my YouTube Channel (165K+ subscribers):
Java Guides Channel

Top 10 My Udemy Courses with Huge Discount:
Udemy Courses - Ramesh Fadatare