Skip to main content

Home > git-documentdb > Collection > getFatDocOldRevision

Collection.getFatDocOldRevision() method#

Get an old revision of a FatDoc data

Signature:
getFatDocOldRevision(shortName: string, revision: number, historyOptions?: HistoryOptions, getOptions?: GetOptions): Promise<FatDoc | undefined>;

Parameters#

ParameterTypeDescription
shortNamestringshortName is a file path whose collectionPath is omitted.
revisionnumberSpecify a number to go back to old revision. Default is 0. See Collection.getHistory() for the array of revisions.
historyOptionsHistoryOptionsThe array of revisions is filtered by HistoryOptions.filter.
getOptionsGetOptions
Returns:

Promise<FatDoc | undefined>

Remarks#

  • undefined if a specified data does not exist or it is deleted.

  • JsonDoc if the file extension is SerializedFormat.extension. Be careful that JsonDoc may not have _id property when an app other than GitDocumentDB creates it.

  • FatBinaryDoc if described in .gitattribtues, otherwise FatTextDoc.

  • getOptions.forceDocType always overwrite return type.

Example#

collection.getFatDocOldRevision(shortName, 0); // returns the latest FatDoc.
collection.getFatDocOldRevision(shortName, 2); // returns a FatDoc two revisions older than the latest.

Exceptions#

Err.DatabaseClosingError

Err.InvalidJsonObjectError