couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hahn <>
Subject Re: url rev=x overwrite document _rev:y
Date Wed, 31 Aug 2011 22:33:36 GMT
I guess I don't understand.  All I can say is that in general you
cannot change the _rev of a doc.  The rev includes a hash of the doc.

If you want to make sure you don't get a conflict, then you will need
to first GET the old doc and use the _rev of that old doc.  I do that
in a loop doing a PUT over and over until I get no conflict.  Of
course it usually works on the first PUT and no GET is needed.

On Wed, Aug 31, 2011 at 2:50 PM, Gert Cuykens <> wrote:
> The app does not need to change the rev in the database, just the _rev
> that is in the PUT or POST data which is about to get send too the
> database. It already happens when adding attachments to couchdb
> preventing conflicts. It is only logic it does this for normal updates
> too when specified explicit in the url ignoring the _rev in the POST
> or PUT data.
> Now I need to parse the json files one by one to change the _rev
> inside the documents that need to get send.
> On Wed, Aug 31, 2011 at 9:00 PM, Mark Hahn <> wrote:
>> The rev is used for replication.  If the app could change a rev,
>> replication would break.
>> On Wed, Aug 31, 2011 at 9:53 AM, Gert Cuykens <> wrote:
>>> I believe that PUT http://localhost:5984/db/mydoc?rev=1-x -d
>>> @newdoc.json should overwrite the _rev in the newdoc.json? Can you
>>> point me too the discussion why this has not been done pleas.

View raw message