couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "HTTP_Document_API" by JensAlfke
Date Wed, 13 Jul 2011 02:02:59 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "HTTP_Document_API" page has been changed by JensAlfke:
http://wiki.apache.org/couchdb/HTTP_Document_API?action=diff&rev1=75&rev2=76

Comment:
Remove info about deprecated 'revs=true' param. Update docs on result of _revs_info.

  The above URLs point to ''some_doc_id'', ''another_doc_id'' and ''BA1F48C5418E4E68E5183D5BD1F06476''
in the database ''test''.
  
  == Documents ==
- A CouchDB document is simply a JSON object. You can use any JSON structure with nesting.
You can fetch the document's revision information by adding ''?revs=true'' or ''?revs_info=true''
to the get request.
+ A CouchDB document is simply a JSON object. You can use any JSON structure with nesting.
You can fetch the document's revision information by adding ''?revs_info=true'' to the get
request.
  
  Here are two simple examples of documents:
  
@@ -51, +51 @@

  ||''_rev'' ||The current MVCC-token/revision of this document ('''mandatory''' and '''immutable''')
||
  ||''_attachments'' ||If the document has attachments, _attachments holds a (meta-)data structure
(see section on [[HTTP_Document_API#Attachments]]) ||
  ||''_deleted'' ||Indicates that this document has been deleted and will be removed on next
compaction run ||
+ ||''_revs_info'' ||A list of revisions of the document, and their availability ||
- ||''_revisions'' ||If the document was requested with ''?revs=true'' this field will hold
a simple list of the documents history ||
- ||''_revs_info'' ||Similar to ''_revisions'', but more details about the history and the
availability of ancient versions of the document ||
  ||''_conflicts'' ||Information about conflicts ||
  ||''_deleted_conflicts'' ||Information about conflicts ||
  
@@ -115, +114 @@

  To find out what revisions are available for a document, you can do:
  
  {{{
- GET /somedatabase/some_doc_id?revs=true HTTP/1.0
+ GET /somedatabase/some_doc_id?revs_info=true HTTP/1.0
  }}}
+ This returns the current revision of the document, but with an additional ''_revs_info''
field, whose value is an array of objects, one per revision. For example:
- This returns the current revision of the document, but with an additional field, ''_revisions'',
the value being a list of the available revision IDs. ''Note though that not every of those
revisions of the document is necessarily still available.'' For example, the content of an
old revision get removed by compacting the database, or it may only exist in a different database
if it was replicated.
- 
- To get more detailed information about the available document revisions, use the ''revs_info''
parameter instead. In this case, the JSON result will contain a ''_revs_info'' property, which
is an array of objects, for example:
  
  {{{
  {
    "_revs_info": [
-     {"rev": "123456", "status": "disk"},
+     {"rev": "123456", "status": "available"},
      {"rev": "234567", "status": "missing"},
      {"rev": "345678", "status": "deleted"},
    ]
  }
  }}}
- Here, ''disk'' means the revision content is stored on disk and can still be retrieved.
The other values indicate that the content of that revision is not available.
+ Here, ''available'' means the revision content is stored in the database and can still be
retrieved. The other values indicate that the content of that revision is not available.
  
  You can fetch the bodies of multiple revisions at once using the parameter `open_revs=["rev1","rev2",...]`,
or you can fetch all leaf revisions using `open_revs=all` (see [[Replication_and_conflicts]]).
The JSON returns an array of objects with an "ok" key pointing to the document, or a "missing"
key pointing to the rev string.
  

Mime
View raw message