How to drop all MongoDB databases

mongo-db-logo
The title of the article is pretty much self-explanatory. So the easiest way I found to drop all your MongoDB databases from mongo CLI is to run this simple command which actually what it does is it goes through the result of getDBNames function and for each DB runs the .dropDatabase function.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.