Nhập môn MongoDB với Python
Filip Schouwenaars
Machine Learning Researcher
# Setup from pymongo import MongoClient client = MongoClient() mov = client.film.movies# Xóa tài liệu khớp bộ lọc, tương tự find_one() res = mov.delete_one({ "title": "gladiator" })# Đã xóa bao nhiêu tài liệu? res.deleted_count
1
# Xóa tất cả phim rất tệ res = mov.delete_many({ "rating": { "$lt": 5.0 } })# Đã xóa bao nhiêu tài liệu? res.deleted_count
4
Nhập môn MongoDB với Python