Skip to content

Instantly share code, notes, and snippets.

@cschlyter
Created April 3, 2013 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cschlyter/5297600 to your computer and use it in GitHub Desktop.
Save cschlyter/5297600 to your computer and use it in GitHub Desktop.
MongoDB: Drop all mongodb databases
// Usage: $ mongo dropAll.js
var dbs = db.getMongo().getDBNames()
for(var i in dbs){
db = db.getMongo().getDB( dbs[i] );
print( "dropping db " + db.getName() );
db.dropDatabase();
@smanoharan1
Copy link

You are missing the closing parenthesis, } for the for loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment