vexGetQuery
vexGetQuery<
TCollectionSlug,TPopulate,D>(client,args):Promise<GetReturn<TCollectionSlug,TPopulate,D>>
Defined in: packages/core/src/collections/api/networkQuery.ts:360
Fetches a single document by ID via a direct network call.
Type Parameters
Section titled “Type Parameters”TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends string
TPopulate
Section titled “TPopulate”TPopulate extends ContainerPopulateShape<PopulateMapFor<TCollectionSlug>> = Record<string, never>
D extends number = 0
Parameters
Section titled “Parameters”client
Section titled “client”Any client exposing query(ref, args).
GetClientArgs<TCollectionSlug, TPopulate, D>
{ id, collection, populate?, depth? }.
Returns
Section titled “Returns”Promise<GetReturn<TCollectionSlug, TPopulate, D>>
The document, or null when no document matches id.
vexFindQuery for the client contract and why the funcRef cast is sound.
Example
Section titled “Example”const post = await vexGetQuery(vex, { id: postId, collection: "posts" });// ^? Post | null