Dennis Zheleznyak

Dennis Zheleznyak

DevOps Engineer bigpanda

© 2021

Delete all databases in MongoDB

To delete all databases from our MongoDB instances, run the following command:

db.adminCommand("listDatabases").databases.forEach(function(d)
	{
	if(d.name!="admin" && d.name!="local" && d.name!="config")
	{
        	db.getSiblingDB(d.name).dropDatabase();
	}
       }
);