You need to be added to the ContributorsGroup to edit the wiki. But don't worry! Just email any Mailing List or grab us on IRC and let us know your user name.
HTTP POST _revs_diff
Method |
POST |
|
Path |
/_revs_diff |
|
Query args |
None |
|
Request body |
JSON object whose keys are document IDs and values arrays of revision IDs |
|
Response body |
JSON object describing which revisions are not in the database |
|
Description
Given a set of document/revision IDs, returns the subset of those that do not correspond to revisions stored in the database.
Its primary use is by the replicator, as an important optimization: after receiving a set of new revision IDs from the source database, the replicator sends this set to the destination database's _revs_diff to find out which of them already exist there. It can then avoid fetching and sending already-known document bodies.
Both the request and response bodies are JSON objects whose keys are document IDs; but the values are structured differently:
In the request, a value is an array of revision IDs for that document.
In the response, a value is an object with a "missing": key, whose value is a list of revision IDs for that document (the ones that are not stored in the database) and optionally a "possible_ancestors" key, whose value is an array of revision IDs that are known that might be ancestors of the missing revisions.
Disclaimer: This information was derived from mailing-list posts and experimentation and has not yet been reviewed by someone familiar with the implementation. --JensAlfke, Dec. 2011
Example
POST /_revs_diff HTTP/1.1
Content-Type: application/json
{"03ee06461a12f3c288bb865b22000170": ["1-b2e54331db828310f3c772d6e042ac9c", "2-3a24009a9525bde9e4bfa8a99046b00d"],
"82e04f650661c9bdb88c57e044000a4b": ["3-bb39f8c740c6ffb8614c7031b46ac162"]}HTTP/1.1 200 OK
Cache-Control: must-revalidate
{"03ee06461a12f3c288bb865b22000170": {"missing": ["2-3a24009a9525bde9e4bfa8a99046b00d"]}}