Created
July 13, 2021 08:04
-
-
Save spuyet/70fd4f8a9833366c7e6306efe61e7b85 to your computer and use it in GitHub Desktop.
Mongo DB collections management
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
// Drop all collections starting with the defined pattern | |
let pattern = 'domain_test#'; | |
db.getCollectionNames().filter((c) => c.startsWith(pattern)).forEach((c) => db[c].drop()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment