Skip to content

Instantly share code, notes, and snippets.

@sekmet
Created January 28, 2016 09:20
Show Gist options
  • Save sekmet/912e2071ddcf96c64e3d to your computer and use it in GitHub Desktop.
Save sekmet/912e2071ddcf96c64e3d to your computer and use it in GitHub Desktop.
Delete everything in a MongoDB database
use <whichever database>
db.getCollectionNames().forEach(function(c) { if (c.indexOf("system.") == -1) db[c].drop(); })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment