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 "HTTP view API" by LukeVenediger
Date Sun, 29 Mar 2009 18:02:09 GMT
Dear Wiki user,

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

The following page has been changed by LukeVenediger:
http://wiki.apache.org/couchdb/HTTP_view_API

The comment on the change is:
Added an example on how to include 'key' in your map function for the key param.

------------------------------------------------------------------------------
    * POST
      * {"keys": ["key1", "key2", ...]} ''Trunk only (0.9)''
  
- ''key'', ''startkey'', and ''endkey'' need to be properly JSON encoded values (for example,
startkey="string" for a string value).
+ ''key'', ''startkey'', and ''endkey'' need to be properly JSON encoded values (for example,
startkey="string" for a string value). You must emit a JSON object containing the property
''key'' in order to use this query parameter. For example:
+ {{{
+ function(doc) {
+ 
+   emit(doc._id, {
+     key: doc._id, // This can be whatever value you choose
+     data: doc.foo.bar
+   });
+ }
+ }}}
  
  A JSON structure of ''{"keys": ["key1", "key2", ...]}'' can be posted to any user defined
view or ''_all_docs'' to retrieve just the view rows matching that set of keys. Rows are returned
in the order of the keys specified. Combining this feature with ''include_docs=true'' results
in the so-called ''multi-document-fetch'' feature.
  

Mime
View raw message