Skip to content

Instantly share code, notes, and snippets.

@masasdani
Created July 15, 2016 06:59
Show Gist options
  • Save masasdani/b13a5a453d62b64f3859f2389c1bd56c to your computer and use it in GitHub Desktop.
Save masasdani/b13a5a453d62b64f3859f2389c1bd56c to your computer and use it in GitHub Desktop.
mongodb sample script
//this will remove all collection except system.*
use <name_of_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