Skip to content

Instantly share code, notes, and snippets.

@bmichalski
Created September 19, 2022 12:43
Show Gist options
  • Save bmichalski/d9a236ba4e86be990dab322405ae448a to your computer and use it in GitHub Desktop.
Save bmichalski/d9a236ba4e86be990dab322405ae448a to your computer and use it in GitHub Desktop.
Drop all mongo databases with prefix
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