couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <>
Subject Re: Does CouchDB check autogenerated document id's?
Date Sat, 03 Jan 2009 00:52:29 GMT
On Fri, Jan 2, 2009 at 4:10 PM, Matt Goodall <> wrote:
> 2009/1/2 Jason Davies <>:
>> On 2 Jan 2009, at 16:11, Paul Davis wrote:
>>> Also, as a random aside, why does _uuids require a POST?

In the normal case you would POST a document to a collection when you
want the server to choose the final URL. However, intermediaries have
a habit of retrying POSTs randomly, so when you POST and id-less Couch
document, occasionally duplicate documents are created. We work around
this by recommending PUT as the document creation method. Of course
clients can specify any document id they'd like to, but for
lightweight clients CouchDB provides the _uuids service.

The POST is pragmatic for cache-control reasons, but also RESTy,
because it exposes the service that CouchDB uses internally for
directing document POSTs to new ids. By using the _uuids service,
clients can become the part of CouchDB that would direct documents to
URLs in a collection.

Chris Anderson

View raw message