DocumentRevisions
Retrieves detailed metadata about document revisions in Cloudant, including information on revision identifiers, history, and conflicts. This allows you to track document changes over time and manage version control effectively.
View-Specific Information
The server pushes a document revision view for every table (database in Cloudant). For example:SELECT TableName FROM sys_tables;
-- MyDatabase1
-- MyDatabase1_DocumentRevisions
-- MyDatabase2
-- MyDatabase2_DocumentRevisions
-- ...
SELECT
This view relies on a DocumentId input for retrieving the records. For the following query:SELECT * FROM MyDatabase1_DocumentRevisions;
-- The query executed internally: SELECT * FROM MyDatabase1_DocumentRevisions WHERE DocumentId IN (SELECT DocumentId FROM MyDatabase1);
, the server will try to automatically retrieve the ids from the corresponding table (database). Note that this may quickly become costly in terms of performance when there are many DocumentId values (records) to fetch from that corresponding table.
In those cases, specifying only the DocumentId values that are of interest yourself should result in better performance. For example:
SELECT * FROM MyDatabase1_DocumentRevisions WHERE DocumentId = 'c1117cda61795fa7f11bd5f722151137';
SELECT * FROM MyDatabase1_DocumentRevisions WHERE DocumentId IN ('c1117cda61795fa7f11bd5f722151137', '7637ec6f1fe4e4e4d2cb080002002c6c');
SELECT * FROM MyDatabase1_DocumentRevisions WHERE DocumentId = 'c1117cda61795fa7f11bd5f722151137' AND RevisionId = '1-a6bbcd9244c7adc9e83c95887433048f';
Columns
| Name | Type | Description |
| DocumentId [KEY] | String | The unique identifier of the Cloudant document. This value is required to locate the specific document whose revision history you want to query. |
| RevisionId [KEY] | String | The identifier of a specific revision of the document. This value allows you to retrieve metadata for a particular version within the document’s revision tree. |