In order to remove a specific document in
Use this method in preference over
#couchdb #couch #delete #remove #document #python
couchDB
, you just need to give delete
function the document itself:couch = couchdb.Server('http://SERVER_IP:PORT/')
your_db = couch['your_db_name']
# we assume you have fetched your_couch_db_doc document
your_db.delete(your_couch_db_doc)
Use this method in preference over
__del__
to ensure you're deleting the revision that you had previously retrieved. In the case the document has been updated since it was retrieved, this method will raise a ResourceConflict
exception:>>> db.delete(doc) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
ResourceConflict: (u'conflict', u'Document update conflict.')
#couchdb #couch #delete #remove #document #python