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 "HttpDocumentApi" by JasonMoiron
Date Wed, 23 Apr 2008 03:05:54 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 JasonMoiron:
http://wiki.apache.org/couchdb/HttpDocumentApi

------------------------------------------------------------------------------
  
  === Modify Multiple Documents With a Single Request ===
  
- CouchDB provides a bulk insert/update feature. To use this, you make a ''POST'' request
to the URI ''/{dbname}/_bulk_docs'', with the request body being a JSON document with "docs"
containing an array of documents.
+ CouchDB provides a bulk insert/update feature. To use this, you make a ''POST'' request
to the URI ''/{dbname}/_bulk_docs'', with the request body being a JSON document containing
a list of new documents to be inserted.  The actual format of the request/result documents
differ between CouchDB 0.7.2 and 0.7.3(svn).
  
+ '''CouchDB 0.7.2''':
+ 
  {{{
- {"docs": [
+ [
    {"_id": "0", "integer": 0, "string": "0"},
    {"_id": "1", "integer": 1, "string": "1"},
    {"_id": "2", "integer": 2, "string": "2"}
+ ]
+ }}}
+ 
+ '''CouchDB 0.7.3(svn)''':
+ 
+ {{{
+ {
+   "docs": [
+     {"_id": "0", "integer": 0, "string": "0"},
+     {"_id": "1", "integer": 1, "string": "1"},
+     {"_id": "2", "integer": 2, "string": "2"}
-  ]
+   ]
  }
  }}}
  
  If you omit the per-document ''_id'' specification, CouchDB will generate unique IDs for
you, as it does for regular ''POST'' requests to the database URI.
  
  The response to such a bulk request would look as follows:
+ 
+ '''CouchDB 0.7.2''':
  
  {{{
  {
@@ -348, +363 @@

      {"ok": true, "id": "0", "rev": "3682408536"},
      {"ok": true, "id": "1", "rev": "3206753266"},
      {"ok": true, "id": "2", "rev": "426742535"}
+   ]
+ }
+ }}}
+ 
+ '''CouchDB 0.7.3(svn)''':
+ 
+ {{{
+ {
+   "ok":true,
+   "new_revs": [
+     {"id": "0", "rev": "3682408536"},
+     {"id": "1", "rev": "3206753266"},
+     {"id": "2", "rev": "426742535"}
    ]
  }
  }}}

Mime
View raw message