↻
⏵︎ Run
import pymongo myclient = pymongo.MongoClient("mongodb://localhost:27017/") #use database named "organisation" mydb = myclient["organisation"] print("List of collections before deletion\n--------------------------") for x in mydb.list_collection_names(): print(x) #get collection named "developers" mycol = mydb["developers"] #delete or drop collection mycol.drop() print("\nList of collections after deletion\n--------------------------") for x in mydb.list_collection_names(): print(x)
Output