title: pymongo : delete records elegantly
body: <p>Here is my code to delete a bunch of records using pymongo</p>
  
  <pre><code>ids = []
  with MongoClient(MONGODB_HOST) as connection:
      db = connection[MONGODB_NAME]
      collection = db[MONGODN_COLLECTION]
      for obj in collection.find({"date": {"$gt": "2012-12-15"}}):
          ids.append(obj["_id"])
      for id in ids:
          print id
          collection.remove({"_id":ObjectId(id)})
  </code></pre>
  
  <p>IS there a better way to delete these records? like delete a whole set of records directly</p>
  
  <pre><code>collection.find({"date": {"$gt": "2012-12-15"}}).delete() or remove()
  </code></pre>
  
  <p>or delete from obj like</p>
  
  <pre><code> obj.delete() or obj.remove()
  </code></pre>
  
  <p>or somehting similar?</p>