Skip to content

Instantly share code, notes, and snippets.

@jpolvora
Created March 28, 2018 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpolvora/d6282dfc020e227205f513a47af27496 to your computer and use it in GitHub Desktop.
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.
/* 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