pouchdb / pouchdb-server

CouchDB-compatible server built on PouchDB and Node
Apache License 2.0
944 stars 155 forks source link

Documentation for ETag header value #471

Open retrodaredevil opened 1 year ago

retrodaredevil commented 1 year ago

Hello.

I'm trying to use pouchdb-server as an in memory database that will replicate to CouchDB. I've made my own Java library to interface with CouchDB over HTTP and it works fine with PouchDB for the most part.

The problem I've come across is that I have no idea what ETag value I'm getting back. For one of my design documents the value is W/"b3-h4qJypewViZK81RbDjSOy/qowQE" after making a GET or HEAD to the document. I'm trying to understand how that relates to the revision of the document, as the revision is what I'm most familiar with working with.

I'm just trying to understand how the ETag value is supposed to be used in place of using the revision as the ETag value. Any documentation or links to relevant code would be appreciated. PouchDB is pretty similar to CouchDB, but when something weird like this pops up it's hard to find any good documentation.

When I'm in CouchDB world, I normally will make a HEAD request to get the revision of the document and use that revision to overwrite an existing document if I wanted to. Now with PouchDB I'm unsure of the best way to go about that.

It also looks to me that this functionality existed at one point, but there's not much context around this discussion: https://github.com/pouchdb/express-pouchdb/issues/101