Introduction à MongoDB en Python
Filip Schouwenaars
Machine Learning Researcher
# Préparation from pymongo import MongoClient client = MongoClient() mov = client.film.movies# Supprimer le document correspondant au filtre, comme find_one() res = mov.delete_one({ "title": "gladiator" })# Combien de documents ont été supprimés ? res.deleted_count
1
# Supprimer tous les très mauvais films res = mov.delete_many({ "rating": { "$lt": 5.0 } })# Combien de documents ont été supprimés ? res.deleted_count
4
Introduction à MongoDB en Python