Answers for "how to remove all data from mongo db collection python"

1

how to remove data from mongo db python

import pymongo

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

myquery = { "address": "Mountain 21" }

mycol.delete_one(myquery)
Posted by: Guest on March-23-2022
3

mongodb remove all from collection

db.collection.remove({})
Posted by: Guest on December-21-2020

Code answers related to "how to remove all data from mongo db collection python"

Browse Popular Code Answers by Language