Skip to main content

Home > git-documentdb > GitDocumentDB > getFatDocOldRevision

GitDocumentDB.getFatDocOldRevision() method#

Get an old revision of a FatDoc data

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

Parameters#

ParameterTypeDescription
namestringname is a file path.
revisionnumberSpecify a number to go back to old revision. Default is 0. See GitDocumentDB.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 SerializeFormat.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.

  • This is an alias of GitDocumentDB#rootCollection.getFatDocOldRevision()

Example#

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

Exceptions#

Err.DatabaseClosingError

Err.InvalidJsonObjectError