MongoDB – Drop Database And Collections

This post will show you how to remove a database and collections from MongoDB.

Bring the database into use using the “Use databaseName” command to drop it. You can then delete the database using the db.dropDatabase() command.

Syntax to drop the database is:
> db.dropDatabase()

> use CompanyDB

switched to CompanyDB
> db.dropDatabase();

Syntax to drop the collection is:
> db.Collection.drop()



I hope you found this post to be informative.

Please join our mailing list to receive more interesting information.

One comment

  1. Very great post. I just stumbled upon your blog and wished to mention that I
    have truly enjoyed surfing around your blog posts.
    In any case I will be subscribing on your rss feed and I’m hoping
    you write again very soon!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s