Created
October 15, 2014 03:01
-
-
Save lxneng/01b5e2182c4d6f616749 to your computer and use it in GitHub Desktop.
(MongoDB) Drop all databases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.adminCommand("listDatabases").databases.forEach( function (d) { | |
if (d.name != "local" && d.name != "admin" && d.name != "config") | |
db.getSiblingDB(d.name).dropDatabase(); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment