Hi James,

Update handlers are not automatically executed on regular document
updates. Instead, you have to PUT your update to an URL like

$HOST/$DB/_design/update/_update/add_user

You will have to process every property manually inside the update
function.

Read more about update handlers in the wiki:
http://wiki.apache.org/couchdb/Document_Update_Handlers

Greetings
Johannes
Am Donnerstag, den 09.09.2010, 00:04 +0100 schrieb James Jackson:
> Hi,
> 
> I'm trying to implement a method to modify all documents before they are 
> written to the DB. From my poking around in various tickets, I believe the 
> updates entry in a design document is what I'm after (I'm running 1.0.1).
> 
> I have inserted the following design document into my database:
> 
> {
>    "_id":"_design/update",
>    "_rev":"1-8800f3bdde13e5bcf6738635f0265b6d",
>    "language":"javascript",
>    "updates" : {
>       "add_user":"function(doc, req){doc.newauth = req.userCtx; return [doc, 
> \"ok\"];}"
>    }
> }
> 
> However, this does not appear to get run when putting a document to the 
> database (nothing in the debug log but the usual). Is this functionality 
> supported? Am I doing something funny? All help appreciated!
> 
> Regards,
> James.

-- 
Netzmerk GbR
Johannes J. Schmidt

http://netzmerk.com
0157 79 76 20 30

Am Vierstückenpfuhl 3a
14167 Berlin

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to