You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2008/07/27 15:11:53 UTC
[Couchdb Wiki] Update of "HttpDocumentApi" by PaulCarey
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 PaulCarey:
http://wiki.apache.org/couchdb/HttpDocumentApi
The comment on the change is:
Updated bulk update/insert. Removed ref to 0.7.2 format. Noted as transactional
------------------------------------------------------------------------------
=== 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 containing a list of new documents to be inserted or updated. The actual format of the request/result documents differ between CouchDB 0.7.2 and 0.7.3(svn).
+ 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 or updated. The bulk post is a transactional operation - all updates/insertions succeed, or all fail.
+ Doc formats below are as per CouchDB 0.8.0.
- '''CouchDB 0.7.2''':
-
- {{{
- [
- {"_id": "0", "integer": 0, "string": "0"},
- {"_id": "1", "integer": 1, "string": "1"},
- {"_id": "2", "integer": 2, "string": "2"}
- ]
- }}}
-
- '''CouchDB 0.7.3(svn)''':
{{{
{
@@ -353, +343 @@
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''':
-
- {{{
- {
- "ok":true,
- "results": [
- {"ok": true, "id": "0", "rev": "3682408536"},
- {"ok": true, "id": "1", "rev": "3206753266"},
- {"ok": true, "id": "2", "rev": "426742535"}
- ]
- }
- }}}
-
- '''CouchDB 0.7.3(svn)''':
{{{
{
@@ -380, +355 @@
}
}}}
- Updating existing documents requires setting the ''_rev'' member to the revision being updated. To delete a document set the ''_deleted'' member to true. '''CouchDB 0.7.3(svn)''':
+ Updating existing documents requires setting the ''_rev'' member to the revision being updated. To delete a document set the ''_deleted'' member to true.
{{{
{