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.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay