Skip to content

GenericQueryClientParams

Defined in: packages/core/src/collections/api/types.ts:82

Base shape for client-side args of a vex.* query function.

Carries the ctx?: never discriminator (forbids passing a Convex query context) and the populate field, since every query function that returns documents supports relationship population (the only outlier is count, which returns a number and overrides populate?: never).

Function-specific args interfaces extend this and add their own per-function fields. limit stays per-function because it doesn’t apply to single-doc queries (get) or scalar queries (count).

Inheritance pattern

// find — adds slug + limit; populate inherited
interface FindClientArgs<TCollectionSlug, TPopulate>
extends GenericQueryClientParams<TCollectionSlug, TPopulate> {
slug: TCollectionSlug;
limit?: number;
}
// get — adds id; populate inherited; no limit (single-doc)
interface GetClientArgs<TCollectionSlug, TPopulate>
extends GenericQueryClientParams<TCollectionSlug, TPopulate> {
id: GenericId<TCollectionSlug>;
}
// search — adds slug + query + index fields + limit; populate inherited
interface SearchClientArgs<TCollectionSlug, TPopulate>
extends GenericQueryClientParams<TCollectionSlug, TPopulate> {
slug: TCollectionSlug;
query: string;
searchIndexName: string;
searchField: string;
limit?: number;
}
// count — returns a number, has no docs to populate; overrides populate
interface CountClientArgs<TCollectionSlug>
extends GenericQueryClientParams<TCollectionSlug> {
slug: TCollectionSlug;
populate?: never;
}

TCollectionSlug extends CollectionSlug = CollectionSlug

The collection slug; used to narrow populate keys via RelationshipKeysOf<TCollectionSlug>. Defaults to the full CollectionSlug union.

TPopulate extends PopulateShape<TCollectionSlug> = Record<string, never>

The populate object. Defaults to Record<string, never> (no relationships populated).

D extends number = number

optional auth?: undefined

Defined in: packages/core/src/collections/api/types.ts:88

Discriminator: client args MUST NOT supply auth.


optional ctx?: undefined

Defined in: packages/core/src/collections/api/types.ts:90

Discriminator: client args MUST NOT supply ctx.


optional depth?: D

Defined in: packages/core/src/collections/api/types.ts:104

Auto-populate all relationship fields to this many levels.

Inferred as the literal D so a wrapper that threads D through to its return type narrows accordingly (depth: 2 → depth-populated doc). A non-literal number degrades to VexDocument via DepthPopulated’s guard. D defaults to number, so wrappers that do not thread it keep the plain passthrough they had before.

Use populate for documented consumer code; depth is internal.


optional drafts?: boolean

Defined in: packages/core/src/collections/api/types.ts:116

When true on a versioned collection, includes the document’s draft row alongside its published row — gated server-side on the readDrafts action (Step 13). Ignored for a non-versioned collection.


optional populate?: TPopulate

Defined in: packages/core/src/collections/api/types.ts:92

Recursive populate object, type-narrowed against RelationshipKeysOf<TCollectionSlug>.


optional skip?: boolean

Defined in: packages/core/src/collections/api/types.ts:110

When true, the wrapper passes convexQuery’s "skip" sentinel instead of args, so the query is not issued. Use for conditional queries (e.g. an id that is not known yet) without violating the Rules of Hooks.