couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Lemasson <djass...@gmail.com>
Subject Re: delete Docs
Date Mon, 05 Apr 2010 13:01:59 GMT
Thanks a lot Nils

thats an elegant, effective and lightweight solution that goes way
beyond my expectations :)
I'm not using couchdb-python yet, still playing with httplib2 to try
and understand the low levels

and indeed couchdb-python uses this :

        status, headers, data = self.resource.head(id)
        self.resource.delete_json(id, rev=headers['etag'].strip('"'))


Fred

2010/4/5 Nils Breunese <N.Breunese@vpro.nl>:
> You don't need to GET the full document to retrieve the current revision. You can just
do a HEAD request and look at the Etag header, which contains the document _rev.
>
> ----
> $ curl --head http://example.com/database/document
> HTTP/1.1 200 OK
> Date: Mon, 05 Apr 2010 12:26:39 GMT
> Server: CouchDB/0.10.1 (Erlang OTP/R13B)
> Etag: "86-ff15272d40894c8d7ece25891a874230"
> (...)
> ----
>
> I usually work with a CouchDB library which abstracts this away (I like couchdb-python
for scripting), but I guess they all use HEAD requests under the hood.
>
> Nils Breunese.

Mime
View raw message