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] Trivial Update of "HTTP_Bulk_Document_API" by SebastianCohnen
Date Fri, 07 May 2010 19:52:59 GMT
Dear Wiki user,

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

The "HTTP_Bulk_Document_API" page has been changed by SebastianCohnen.
http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API?action=diff&rev1=8&rev2=9

--------------------------------------------------

     * By adding {{{?startkey="xx"&endkey="yy"}}} you can get the documents with keys
in a certain range
     * By POSTing to _all_docs you can get a set of documents with arbitrary keys
  
+ 
+ Simple exmple to fetch the keys {{{bar}}} and {{{baz}}} and include the complete document
in the result set:
  {{{
  curl -d '{"keys":["bar","baz"]}' -X POST http://127.0.0.1:5984/foo/_all_docs?include_docs=true
  }}}
  
+ Result:
  {{{#!highlight javascript
  {"total_rows":3,"offset":0,"rows":[
  {"id":"bar","key":"bar","value":{"rev":"1-4057566831"},"doc":{"_id":"bar","_rev":"1-4057566831","name":"jim"}},
@@ -22, +25 @@

  ]}
  }}}
  
+ Example with startkey and endkey ('''be aware''' of correct url encoding!):
  {{{
  curl 'http://127.0.0.1:5984/foo/_all_docs?include_docs=true&startkey="ba"&endkey="bb"'
  }}}
  
+ Result:
  {{{#!highlight javascript
  {"total_rows":3,"offset":0,"rows":[
  {"id":"bar","key":"bar","value":{"rev":"1-4057566831"},"doc":{"_id":"bar","_rev":"1-4057566831","name":"jim"}},
@@ -135, +140 @@

  $ curl -X PUT "$DB"
  }}}
  
+ Result:
  {{{#!highlight javascript
  {"ok":true}
  }}}
+ 
  {{{
  $ curl -X PUT -d '{"name":"fred"}' "$DB/person"
  }}}

Mime
View raw message