couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <>
Subject Re: url rev=x overwrite document _rev:y
Date Wed, 31 Aug 2011 23:12:07 GMT

On Aug 31, 2011, at 4:00 PM, Gert Cuykens wrote:

> The first example, will result into a document conflict because rev is
> not specified in the doc and the rev from the the url gets ignored.
> All other examples work

I think what you’re pointing out is that when PUTting a document you have to specify the
current revision as a _rev key in the JSON; whereas many related requests (like DELETE, COPY
and PUT of an attachment) specify the revision in a “?rev=“ URL query parameter instead.

I _think_ the reason for this is that PUT came first and has the simplicity of requiring that
you send back a modified copy of the exact document you got from the GET. When the other requests
were added they didn’t have any obvious JSON body to hold the _rev, so they added it to
the URL instead.

It seems reasonable to suggest that PUT be allowed to specify the revision ID in the URL as
an option. It might simplify some client’s code if it were consistent with the other requests
that modify documents.

View raw message