दस्तावेज़ हटाना

Python में MongoDB परिचय

Filip Schouwenaars

Machine Learning Researcher

एक दस्तावेज़ हटाना

# Setup
from pymongo import MongoClient
client = MongoClient()
mov = client.film.movies

# Delete document that matches filter, similar to find_one() res = mov.delete_one({ "title": "gladiator" })
# How many documents were deleted? res.deleted_count
1
Python में MongoDB परिचय

एक साथ कई दस्तावेज़ हटाना

# Delete all really bad movies
res = mov.delete_many({ "rating": { "$lt": 5.0 } })

# How many documents deleted? res.deleted_count
4
  • दस्तावेज़ हटाना स्थायी है और वापस नहीं किया जा सकता!
  • हटाने से पहले अपने फ़िल्टर दोबारा जाँचें!
Python में MongoDB परिचय

अभ्यास करते हैं!

Python में MongoDB परिचय

Preparing Video For Download...