couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samuel Williams <space.ship.travel...@gmail.com>
Subject Re: ddoc updates
Date Sun, 22 Jul 2012 08:51:47 GMT
Thanks Alex, that all makes sense.

On 22 July 2012 20:49, Alexander Shorin <kxepal@gmail.com> wrote:

> On Sun, Jul 22, 2012 at 12:43 PM, Samuel Williams
> <space.ship.traveller@gmail.com> wrote:
> > Is it possible to signal an error from updates, e.g. that the update
> wasn't
> > possible?
>
> You may exit gracefully from update handler:
> >>> return [null, {"code": 400, "json": {"error": "bad_request", "reason":
> "sorry, failed"}}]
> or explicitly raise an error:
> >>> throw {"failed": "why"}
> Last thing would be catched by query server internals and prevents
> process crush by forwarding error details back to CouchDB.
>
> > It feels like updates could almost be a mapping function in the sense
> that
> > given some input data, output one or more documents, following the emit
> > style model.. it wouldn't fit with the existing approach but it just
> seems
> > like it might be a nicer model?
>
> Update handlers operates with only single document: which exists or
> not yet. The only special thing of update handlers is that you're able
> to implement business logic on server side, not on client. For others,
> they provides no more additional features against regular document
> saving via POST/PUT request.
>
> --
> ,,,^..^,,,
>
>
> On Sun, Jul 22, 2012 at 12:43 PM, Samuel Williams
> <space.ship.traveller@gmail.com> wrote:
> > Hi again,
> >
> > Is it possible to signal an error from updates, e.g. that the update
> wasn't
> > possible?
> >
> > It feels like updates could almost be a mapping function in the sense
> that
> > given some input data, output one or more documents, following the emit
> > style model.. it wouldn't fit with the existing approach but it just
> seems
> > like it might be a nicer model?
> >
> > Kind regards,
> > Samuel
>

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