Skip to content

getLatestVersion

getLatestVersion<DataModel>(props): Promise<VexVersion | null>

Defined in: packages/core/src/versions/model.ts:102

Returns a document’s highest-numbered vex_versions row, or null if it has no version history yet.

Always queries via the by_document_version index and takes the single newest row — never .collect()s the full history, since this runs on every saveDraft/publish call to compute the next version number.

DataModel extends GenericDataModel

Input props.

string

The collection slug.

GenericQueryCtx<DataModel> | GenericMutationCtx<DataModel>

A Convex query or mutation context.

string

The document’s _id, stringified.

Promise<VexVersion | null>

The latest version row, or null when the document has never been snapshotted.