No al cierre de webs
TreeWeb::Artículos::MongoDB::Drop all databases in MongoDB
Permalink: http://www.treeweb.es/u/1300/ 27/11/2015

Drop all databases in MongoDB

Maybe you desire drop all databases in one command, but Mongo shell does not have one command to do it. The first approach is to use js inside the sell to do the task: iterate all database names and drop them one by one. So, open your Mongo shell and type:


db.adminCommand( { listDatabases: 1 } ).databases.forEach(function(d){ db.getSiblingDB(d.name).dropDatabase(); })