Created
September 19, 2022 12:43
-
-
Save bmichalski/d9a236ba4e86be990dab322405ae448a to your computer and use it in GitHub Desktop.
Drop all mongo databases with prefix
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
const prefix = '<prefix>'; | |
db.getMongo().getDBNames().forEach((dbName) => { | |
if (dbName.indexOf(prefix) === 0) { | |
db.getMongo().getDB(dbName).dropDatabase(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment