18

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

user89021
  • 14,784
  • 16
  • 53
  • 65

1 Answers1

22

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
  • 18,183
  • 8
  • 41
  • 48