-
Notifications
You must be signed in to change notification settings - Fork 140
Bulk GET
_bulk_get is a nonstandard (i.e. non-CouchDB) addition to the sync API. It improves performance of client pull replications, by allowing the client to request multiple documents in one request. The usual CouchDB API for bulk gets -- a POST to _all_docs with an array of docIDs -- isn't suitable for the replicator because there's no way to specify which specific revisions are needed, the response doesn't contain the revision history, and attachments can only be encoded inline not as MIME multipart.
POST /db/_bulk_get
-
?revs=true: Each returned revision body will include its revision history as a_revisionsproperty. -
?attachments=true: Attachments will be included in the response.
A JSON object with a property "docs" whose value is an array of objects, each describing a revision to return. Each of these objects has properties "id", "rev", and optionally "atts_since".
Example:
{"docs": [
{"id": "somedoc", "rev": "2-cafebabe", "atts_since": [12,...]},
{"id": "otherdoc", "rev": "5-bedbedbe"}, ...
]}The response is of type multipart/related. Each part contains one document revision. The ordering is the same as in the array in the request.
Each revision itself is encoded as multipart, in the same format as a document GET request with attachments: the main JSON body comes first, then a body for each attachment. Each attachment body has a Content-Disposition header identifying its attachment name.