couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Cohnen <>
Subject Re: Revsion Explained
Date Sun, 12 Sep 2010 13:33:06 GMT
Correct, you cannot use the _rev field (nor parts of it) to test for equality of two documents.
you can however use the _rev token to verify that the given documents and their history are
equal, since that is what conflict detection actually does.

On 12.09.2010, at 15:24, Ido Ran wrote:

> Thank you for the answer.
> I though it is possible to compare two _rev fields of two documents and
> based on the hash part (not the integer) to tell if they have the same
> content. I guess it is not possible.
> Ido
> On Sun, Sep 12, 2010 at 3:14 PM, Sebastian Cohnen <
>> wrote:
>> Hi Ido,
>> consider the _rev token as an opaque value necessary for the mvcc (I'd call
>> it mvcc-token, since "revision" is often misunderstood). The hash algorithm
>> may even change someday. AFAIK it contains the document itself and also its
>> history (at least parts of it). The algorithm ensures that the same document
>> with the same history result in the same _rev token even on two different
>> nodes. This behavior is required for conflict detection/resolution.
>> Best
>> Sebastian
>> On 12.09.2010, at 14:43, Ido Ran wrote:
>>> Hi,
>>> I've read that the _rev fiel in each document is composed of two parts -
>>> integer which increment by 1 on each change and MD5 hash of the JSON of
>> the
>>> document.
>>> What part of the JSON is included in that hash?
>>> I've created a new document with _id of "foo" and single field name
>> "start"
>>> with value "99". I've save the document and it got _rev of
>>> "1-b563730fcffb6583ff48980c1533e439".
>>> I didn't change anything, just hit save again in Futon and not the _rev
>> is
>>> "2-75a41bb3bc74cb4d768466efa2a0c1ca".
>>> If I hit save again I get another hash.
>>> Why is that?
>>> Thank you,
>>> Ido

View raw message