Created
September 11, 2015 19:01
-
-
Save Voronenko/87073d80f144640257ec to your computer and use it in GitHub Desktop.
Drop mongo databases by pattern
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
var regExp = /_test_/; | |
db.getMongo().getDBNames().filter(function(name){ | |
return name.match(regExp) | |
}).forEach(function(name){ | |
print(name); | |
var thedb = db.getMongo().getDB( name ); | |
thedb.dropDatabase(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment