tags:

views:

98

answers:

1

How can I just check if a document exists, mabye get the revision, but not make couchdb send the body of the document?

I remember I saw this explained somewhere but I cannot find it.

Edit: Iirc in the example you received only a http header with no data. The header indicated if present or not.

Edit2: Evan suggests to make a HEAD request (instead of GET). This answers my question.

CouchDB sends an ETag Header for document requests. The ETag Header is simply the document's revision in quotes.

Quoted from: http://wiki.apache.org/couchdb/HTTP_Document_API#ETags.2BAC8-Caching

+3  A: 

Instead of performing a HTTP GET request, do a HTTP HEAD request. This will only return the headers and no content. The returned status will tell you if the object exists.

Evan
Thank you, I will try that soon :) - karlthorwald - aka