Python MongoDB Drop Collection







googletag.cmd.push(function() { googletag.display('div-gpt-ad-1422003450156-2'); });



Python MongoDB Drop Collection



❮ Previous
Next ❯



Delete Collection



You can delete a table, or collection as it is called in MongoDB, by using
the drop() method.



Example


Delete the "customers" collection:



import pymongo

myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient["mydatabase"]
mycol = mydb["customers"]

mycol.drop()

Run example »


The drop() method returns true if the collection was dropped successfully,
and false if the collection does not exist.






❮ Previous
Next ❯

Popular posts from this blog

Chat program with C++ and SFML

Function to Return a JSON Like Objects Using VBA Collections and Arrays

Will my employers contract hold up in court?