You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Benoit Chesneau <bc...@gmail.com> on 2010/02/14 10:09:20 UTC

_update handler improvment

While working on the couch.it couchapp, I'm currently thinking that
_update handler could be improved. I would like to be able to return
the doc revision and doc id from the doc we update/create/delete from
_update. Actually this isn't possible since doc is created while we
return the response.

So current schema is :

1) update doc with _update, return response
2) get rev of doc with another call

Of course it could be solved by a simple call to the db
(PUT/POST/DELETE) but then I have to expose the db, and I have to do
all work on client side. Which in my case isn't a real problem but
could be in more sensitive application.

I think we cold solve this by simply returning the doc id and rev as
http headers which will solved most cases.

Any thoughts about it ?

- benoit

Re: _update handler improvment

Posted by Chris Anderson <jc...@apache.org>.
On Sun, Feb 14, 2010 at 1:09 AM, Benoit Chesneau <bc...@gmail.com> wrote:
> While working on the couch.it couchapp, I'm currently thinking that
> _update handler could be improved. I would like to be able to return
> the doc revision and doc id from the doc we update/create/delete from
> _update. Actually this isn't possible since doc is created while we
> return the response.
>
> So current schema is :
>
> 1) update doc with _update, return response
> 2) get rev of doc with another call
>
> Of course it could be solved by a simple call to the db
> (PUT/POST/DELETE) but then I have to expose the db, and I have to do
> all work on client side. Which in my case isn't a real problem but
> could be in more sensitive application.
>
> I think we cold solve this by simply returning the doc id and rev as
> http headers which will solved most cases.
>

If we are going to do this we should make it consistent across the API.

We should also return the current db's update_seq in a header on all
doc / db responses.

And the current seq of the view index on each view response.

Chris

> Any thoughts about it ?
>
> - benoit
>



-- 
Chris Anderson
http://jchrisa.net
http://couch.io