DEV Community

Cover image for How to drop a collection from MongoDB
Donald Feury
Donald Feury

Posted on • Originally published at donaldfeury.xyz on

1 1

How to drop a collection from MongoDB

How to drop a collection from MongoDB

For a full overview of MongoDB and all my posts on it, check out my overview.

WARNING! This is a dangerous command that will result in the loss of data

If you want to completely drop a collection, which will result in the loss of all documents in that collection, there is one simple command to do that called drop.

To drop a collection in your MongoDB instance called podcasts:

db.podcasts.drop()

Enter fullscreen mode Exit fullscreen mode

Only do this if you're sure you want to completely reset that collection.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post