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 2009/03/19 16:31:50 UTC
[Couchdb Wiki] Update of "HTTP Document API" by BrianCandler
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 BrianCandler:
http://wiki.apache.org/couchdb/HTTP_Document_API
The comment on the change is:
Give 0.9 response format
------------------------------------------------------------------------------
=== 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 bulk post is currently (0.8.0) a transactional operation - all updates/insertions succeed, or all fail - but that behaviour may change in future (see http://n2.nabble.com/couchdb-transactions-changes-td2289541.html for more information).
+ 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 was (0.8.0) a transactional operation - all updates/insertions succeed, or all fail - but that behaviour has now changed as of 0.9.x, and each document may individually succeed or fail (see http://n2.nabble.com/couchdb-transactions-changes-td2289541.html for more information).
- Doc formats below are as per CouchDB 0.8.0.
+ Doc formats below are as per CouchDB 0.9.x.
{{{
{
@@ -349, +349 @@
The response to such a bulk request would look as follows:
{{{
+ [
- {
- "ok":true,
- "new_revs": [
{"id": "0", "rev": "3682408536"},
{"id": "1", "rev": "3206753266"},
+ {"id": "2", "error": "conflict", "reason": "Document update conflict."}
+ ]
- {"id": "2", "rev": "426742535"}
- ]
- }
}}}
Updating existing documents requires setting the ''_rev'' member to the revision being updated. To delete a document set the ''_deleted'' member to true.