Created
November 5, 2013 21:40
-
-
Save queertypes/7326836 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
try: | |
import pymongo | |
except ImportError: | |
print('error: missing `pymongo`: `pip install pymongo`') | |
quit() | |
import sys | |
remove_set = ['messages', 'queues', 'catalogue'] | |
try: | |
conn = pymongo.MongoClient(sys.argv[1]) | |
except Exception: | |
print('usage: {0} mongodb_uri'.format(sys.argv[0])) | |
quit() | |
for db in conn.database_names(): | |
if any([(x in db) for x in remove_set]): | |
print('dropping {0}'.format(db)) | |
conn.drop_database(db) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment