couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Joseph Davis (JIRA)" <>
Subject [jira] Updated: (COUCHDB-441) Finally implement pre-write-doc-edit handlers.
Date Sun, 02 Aug 2009 07:08:14 GMT


Paul Joseph Davis updated COUCHDB-441:

    Attachment: COUCHDB-441.patch

Yep. This is a patch for _update handlers.

To use them, create a _design doc that looks like this:

  "_id": "_design/foo",
  "updates": {
    "mult": "function(oldDoc, newDoc, req, userCtx) {oldDoc.value = oldDoc.value * 2;}"

And then PUT a document to this URL:${DOCID}

or POST a document to

You can also pull the code from:


If you're of the git persuasion.

Also, I realized while implementing this that it more or less enables an often sought after
ability with a small caveat. +1 beer to the person that spots that. +6 beers to the person
that sees the caveat.

Yay updates!

> Finally implement pre-write-doc-edit handlers.
> ----------------------------------------------
>                 Key: COUCHDB-441
>                 URL:
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>    Affects Versions: 0.10
>            Reporter: Curt Arnold
>             Fix For: 0.10
>         Attachments: COUCHDB-441.patch
> It would be useful for auditing to have the identity of the user who inserted a new revision
and the timestamp of the operation to be inserted in the document in the same way that the
new revision number is.
> Doing this at the application level is not adequate since it would be readily spoofable
and would bypass the authentication handler.
> There is a comment in couch_db:update_docs about generating new revision ids, but I couldn't
quite comprehend what specific code was responsible for inserting the id into the document.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message