mongodb_005.py

#! /usr/bin/python3
# ==================================================================
# drop database
# ==================================================================

database = 'phonedb'

print(f'drop database {database}')

from pymongo import MongoClient

client = MongoClient()

results = client.drop_database(database)

print(f'drop results: {results}')

dbs = client.list_database_names()
for d in dbs:
    print(f'database: {d}')