Skip to content

AccessIndexSelection

AccessIndexSelection<TDoc, TIndexFields> = { [N in keyof TIndexFields & string]: { name: N; range: (ix: ConstraintBuilder<TIndexFields[N], TDoc, 0>) => ConstraintResult } }[keyof TIndexFields & string]

Defined in: packages/core/src/access/queryConstraintTypes.ts:288

The index half of an access rule: which declared index to read through and the range over its fields, as a discriminated object — the same shape as find’s withIndex argument, with range required.

Discriminating on the literal name is what types ix against THAT index’s field tuple, in declaration order, so Convex’s field-order rule is a compile error at the rule.

TDoc

Document shape range values are typed from.

TIndexFields extends Record<string, readonly string[]>

The resource’s index name → field tuple map.