Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a couchdb document exists (without retrieving it)?

Tags:

couchdb

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

like image 338
user89021 Avatar asked May 14 '10 01:05

user89021


People also ask

How do I check my CouchDB status?

In case you want to check the status of CouchDB, you can do so using the following command: sudo status couchdb.

Is CouchDB on the Cloud?

CouchDB packaged by BitnamiBitnami has partnered with Google to make CouchDB available in the Google Cloud Platform.

What kind of database is CouchDB?

Apache CouchDB (CouchDB (link resides outside IBM)) is an open source NoSQL document database that collects and stores data in JSON-based document formats.

Which type of NoSQL database is CouchDB?

CouchDB is an open source NoSQL database based on common standards to facilitate Web accessibility and compatibility with a variety of devices. NoSQL databases are useful for very large sets of distributed data, especially for the large amounts of non-uniform data in various formats that is characteristic of big data.


1 Answers

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.

like image 100
Evan Avatar answered Nov 10 '22 00:11

Evan