Created
February 22, 2018 17:51
-
-
Save hbarcelos/718cefe0547aff96d9e28a1d75cff04c to your computer and use it in GitHub Desktop.
Remove all user-created DBs from mongo.
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.getMongo().getDBNames() | |
.filter(function(db) { | |
return ['admin', 'config', 'local'].indexOf(db) === -1 | |
}) | |
.forEach(function (dbName) { | |
db.getMongo().getDB(dbName).dropDatabase(); | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment