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.
Type Parameters
Section titled “Type Parameters”DataModel
Section titled “DataModel”DataModel extends GenericDataModel
Parameters
Section titled “Parameters”Input props.
collection
Section titled “collection”string
The collection slug.
GenericQueryCtx<DataModel> | GenericMutationCtx<DataModel>
A Convex query or mutation context.
documentId
Section titled “documentId”string
The document’s _id, stringified.
Returns
Section titled “Returns”Promise<VexVersion | null>
The latest version row, or null when the document has never
been snapshotted.