Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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