How to Delete Collection Using Drop() Method in Python


In this example we will show how to delete the collection using the drop() method in Python MongoDB.

Source Code

from pymongo import MongoClient

client = MongoClient("localhost", 27017)
db = client["mydatabase"]
collection = db["us_state"]

collection.drop()
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments