Sometimes, you need to delete a single record, while at other times you need to delete many. This recipe shows you how to delete multiple records matching a filter.
As before, determine the records that you want to delete, and create a filter for them.
from pymongo import MongoClient client = MongoClient('localhost', 27017) db = client.pythonbicookbook customers = db.customers result = customers.delete_many({ 'contact_requested': False }) print(result.deleted_count)