couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Smith <>
Subject Re: Auto-UUID generation in _update [PATCH]
Date Sat, 12 Jun 2010 15:48:08 GMT
On Sat, Jun 12, 2010 at 22:18, Paul Bonser <> wrote:

> I just realized that there's nothing keeping the update handler from
> generating a new document no matter if an existing document was passed
> in or not.

My feeling about that is, hey, nothing stops you from writing a bad update
function. You could return invalid JSON already. So I kind of like your
auto-id on the way in idea. However that still doesn't answer the problem
that _update in general does not process JSON, it processes text.

I wonder, for

    function(doc, req) { ... }

Why not have these three cases:

 * Document update: doc is something, == doc._id
 * Document create, PUT to _update/some_id: doc is null, is "some_id"
 * Document create, POST to _update, doc is null, is a random uuid

The update function can decide whether or not to honor the "suggested" doc
id but at least it is now capable of matching the JSON API.

Jason Smith
Couchio Hosting

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message