couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "Document_Update_Handlers" by sebjames
Date Tue, 19 Jun 2012 15:21:06 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Document_Update_Handlers" page has been changed by sebjames:
http://wiki.apache.org/couchdb/Document_Update_Handlers?action=diff&rev1=23&rev2=24

Comment:
The usage example making use of in-place didn't work. I added another example in-place-query
and changed the usage example to refer to this.

      "in-place" : "function(doc, req) {
        var field = req.form.field;
        var value = req.form.value;
+       var message = 'set '+field+' to '+value;
+       doc[field] = value;
+       return [doc, message];
+     }",
+ 
+     "in-place-query" : "function(doc, req) {
+       var field = req.query.field;
+       var value = req.query.value;
        var message = 'set '+field+' to '+value;
        doc[field] = value;
        return [doc, message];
@@ -147, +155 @@

  
  The document id specified in a PUT request URI is available in the update handler as id
property on the request object (req.id).
  
- For example, to invoke the `in-place` handler defined above, PUT to:
+ For example, to invoke the `in-place-query` handler defined above, PUT to:
  
  {{{
- http://127.0.0.1:5984/<my_database>/_design/<my_designdoc>/_update/in-place/<mydocId>?field=title&value=test
+ http://127.0.0.1:5984/<my_database>/_design/<my_designdoc>/_update/in-place-query/<mydocId>?field=title&value=test
  }}}
  This means that unlike document validators, the user's intent must be clear by calling this
individual handler explicitly. In this sense, you should think about an ''_update'' handler
as complementary to ''_show'' functions, not to ''validate_doc_update'' functions.
  

Mime
View raw message