Skip to content

resolveCollectionIndexes

resolveCollectionIndexes(props): ResolvedCollectionIndex[]

Defined in: packages/core/src/collections/resolveCollectionIndexes.ts:53

Every index a collection declares, in schema order (collection-level entries first, then field-level and automatic relationship indexes in field order), with precedence applied: an explicit field-level index wins over a collection-level indexes entry of the same name, which wins over a relationship field’s automatic by_<fieldKey> index.

The one source of index truth. The schema generator, vex generate, access-rule validation, the draft-status lookup and defineCollection all read it, so they cannot disagree about which indexes exist. Fields inside tabs / row / collapsible count under their data keys (getDataFields).

Input props.

{ fields: Record<string, AdminField>; indexes?: readonly object[]; slug: string; }

A collection, or a global (which declares no indexes).

Record<string, AdminField>

readonly object[]

string

ResolvedCollectionIndex[]

The resolved indexes.

When two fields declare the same index name; when a field-level index takes another relationship field’s automatic name; when additionalFields names an unknown field, the field itself, or a field twice; or when two collection-level indexes entries share a name.