Revisions: Loading Revisions
There are a few methods that allow you to download revisions from a database:
-
session.advanced.revisions.getFor()
- can be used to return all previous revisions for a specified document
-
session.advanced.revisions.getMetadataFor()
- can be used to return metadata of all previous revisions for a specified document
-
session.advanced.revisions.get()
- can be used to retrieve a revision(s) using a change vector(s)
getFor
Syntax
session.advanced.revisions.getFor(id, [options], [callback]);
Parameters | ||
---|---|---|
id | string | document ID for which the revisions will be returned for |
options | object | |
start | number | used for paging - results start page |
pageSize | number | used for paging - size of the results page |
documentType | class | type of results |
callback | error-first callback | results callback |
Example
const orderRevisions = await session.advanced.revisions
.getFor("orders/1-A", {
start: 0,
pageSize: 10
});
getMetadataFor
Syntax
session.advanced.revisions.getMetadataFor(id, [options], [callback]);
Parameters | ||
---|---|---|
id | string | document ID for which the revisions will be returned for |
options | object | |
start | number | used for paging - results start page |
pageSize | number | used for paging - size of the results page |
documentType | class | type of results |
callback | error-first callback | results callback |
Example
const orderRevisionsMetadata = await session.advanced.revisions
.getMetadataFor("orders/1-A", {
start: 0,
pageSize: 10
});
get
Syntax
session.advanced.revisions.get(changeVector, [documentType], [callback]);
session.advanced.revisions.get(changeVectors, [documentType], [callback]);
Parameters | ||
---|---|---|
changeVector or changeVectors | string or string[] | one or many revision change vectors |
documentType | class | type of results |
callback | error-first callback | results callback |
Example
const orderRevision = await session.advanced.revisions
.get(orderRevisionChangeVector);