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/25 10:00:32 UTC
[Couchdb Wiki] Update of "HTTP Bulk 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_Bulk_Document_API
The comment on the change is:
Update examples using 0.9.0 rev format
------------------------------------------------------------------------------
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:
+ The response to such a bulk request would look as follows (reformatted for clarity):
{{{
[
- {"id": "0", "rev": "3682408536"},
+ {"id":"0","rev":"1-62657917"},
- {"id": "1", "rev": "3206753266"},
+ {"id":"1","rev":"1-2089673485"},
- {"id": "2", "rev": "426742535"}
+ {"id":"2","rev":"1-2063452834"}
]
}}}
@@ -55, +55 @@
{{{
{
"docs": [
- {"_id": "0", "_rev": "3682408536", "_deleted": true},
+ {"_id": "0", "_rev": "1-62657917", "_deleted": true},
- {"_id": "1", "_rev": "3206753266", "integer": 2, "string": "2"},
+ {"_id": "1", "_rev": "1-2089673485", "integer": 2, "string": "2"},
- {"_id": "2", "_rev": "426742535", "integer": 3, "string": "3"}
+ {"_id": "2", "_rev": "1-2063452834", "integer": 3, "string": "3"}
]
- }
+ }
}}}
Note that CouchDB will return in the response an id and revision for every document passed as content to a bulk insert, even for those that were just deleted.
@@ -68, +68 @@
{{{
[
- {"_id": "0", "error:" "conflict", "reason": "Document update conflict."},
+ {"id":"0","error":"conflict","reason":"Document update conflict."},
- {"_id": "1", "_rev": "725846561", "integer": 2, "string": "2"},
- {"_id": "2", "_rev": "517381856", "integer": 3, "string": "3"}
+ {"id":"1","rev":"2-1579510027"},
+ {"id":"2","rev":"2-3978456339"}
]
}}}
@@ -95, +95 @@
{
"all_or_nothing": true,
"docs": [
- {"_id": "0", "_rev": "3682408536", "integer": 10, "string": "10"},
+ {"_id": "0", "_rev": "1-62657917", "integer": 10, "string": "10"},
- {"_id": "1", "_rev": "3206753266", "integer": 2, "string": "2"},
+ {"_id": "1", "_rev": "2-1579510027", "integer": 2, "string": "2"},
- {"_id": "2", "_rev": "426742535", "integer": 3, "string": "3"}
+ {"_id": "2", "_rev": "2-3978456339", "integer": 3, "string": "3"}
]
}
}}}