How to drop a collection from MongoDB
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.
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()
Only do this if you're sure you want to completely reset that collection.
Did you find this information useful? If so, consider heading over to my donation page and drop me some support.
Want to ask a question or just chat? Contact me here