You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
704 B
Python

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

#!/usr/bin/env python
"""Drop database utility
"""
import sys
import pymongo
from pymongo import MongoClient
import urllib.parse
mongo_ip = sys.argv[1]
mongo_admin = sys.argv[2]
mongo_password = sys.argv[3]
username = urllib.parse.quote_plus(mongo_admin)
password = urllib.parse.quote_plus(mongo_password)
dbclient = MongoClient('mongodb://%s:%s@%s:27017' % (username, password, mongo_ip))
#myclient = pymongo.MongoClient("mongodb://dbadmin:Test123@<ip>:27017/?authSource=the_database&authMechanism=SCRAM-SHA-1")
actesdb = dbclient["actesdb"]
housecol = actesdb["house"]
actecol = actesdb["acte"]
helpers = actesdb["helpers"]
# remove collections
actecol.drop()
housecol.drop()
helpers.drop()