I'm trying to delete a collection in mongodb via pymongo,but its not deleting.Where did i go wrong? I have check in stackoverflow for different ways to delete a collection but its not working. Help please
code: https://pastebin.com/LEAJXvHP
I'm trying to delete a collection in mongodb via pymongo,but its not deleting.Where did i go wrong? I have check in stackoverflow for different ways to delete a collection but its not working. Help please
code: https://pastebin.com/LEAJXvHP
It worked for me to use drop_collection (collection_name) to remove collections. (Python 2.7 and using pymongo)
Example:
mongoClient = MongoClient("xx.xx.xx.xx:27017")
db = mongoClient["DB_name"]
db.drop_collection ("collection_name")
I hope it helps you. Regards,
Beeing "mongo" the variable name that holds the instance of PyMongo, mongo.db.drop_collection("collection_name")
should do the trick.