Created
March 28, 2018 05:24
-
-
Save jpolvora/d6282dfc020e227205f513a47af27496 to your computer and use it in GitHub Desktop.
Shell command for Remove all documents for all collections of a MongoDb. Use with caution.
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
/* use in a shell like robomongo / robo3t */ | |
db.getCollectionNames().forEach( | |
function(collection_name) { | |
db[collection_name].remove({}) | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment