Skip to content

RelationshipField

Defined in: packages/core/src/fields/relationship/types.ts:140

Resolved configuration for a relationship() field, after all defaults are applied.

TCollection is the string-literal type of the target collection’s slug, inferred from RelationshipFieldInput.collection.

TCollection

The target collection slug (inferred from input).

TCollectionSlug extends VexResourceSlug = VexResourceSlug

TFieldMeta extends object = { }

TTargetSlug extends CollectionSlug = CollectionSlug

TComponent extends ComponentHKT = ComponentHKT

admin: RelationshipFieldAdminConfig<TCollectionSlug, TTargetSlug, TComponent>

Defined in: packages/core/src/fields/relationship/types.ts:158

Resolved admin UI configuration with all defaults applied.

BaseField.admin


collection: object

Defined in: packages/core/src/fields/relationship/types.ts:148

Target collection reference.

slug: TTargetSlug

The slug of the collection this field links to.


optional defaultValue?: unknown

Defined in: packages/core/src/fields/baseTypes.ts:574

Pre-filled value shown in the admin form when creating a new field. Does not apply to database values

BaseField.defaultValue


optional description?: string

Defined in: packages/core/src/fields/baseTypes.ts:585

Semantic description of the field. Used in three places:

  1. Helper text rendered below the field input in the admin form UI.
  2. As the Zod .meta({ description }) value for form validation.
  3. As the JSDoc comment on the generated document interface property.

To write a separate JSDoc comment, use interfaceDescription in addition.

BaseField.description


hasMany: boolean

Defined in: packages/core/src/fields/relationship/types.ts:153

Whether this field stores multiple document references.


optional index?: ResolvedFieldIndexConfigInput

Defined in: packages/core/src/fields/baseTypes.ts:589

Convex index name for this field, or the object form for a compound index.

BaseField.index


optional interfaceDescription?: string

Defined in: packages/core/src/fields/baseTypes.ts:587

The JSDoc comment on the generated document interface property

BaseField.interfaceDescription


interfaceType: string

Defined in: packages/core/src/fields/baseTypes.ts:591

TypeScript type string written to generated document interfaces (e.g. "string", "number", "string[]").

BaseField.interfaceType


label: string

Defined in: packages/core/src/fields/baseTypes.ts:567

Display label shown in the admin form. Always set — inferred from the field key if not provided.

BaseField.label


optional max?: FieldLimit

Defined in: packages/core/src/fields/relationship/types.ts:157

Maximum number of related documents allowed, with its resolved error message.

FieldLimit


meta: TFieldMeta

Defined in: packages/core/src/fields/baseTypes.ts:592

BaseField.meta


optional min?: FieldLimit

Defined in: packages/core/src/fields/relationship/types.ts:155

Minimum number of related documents required, once a value is supplied, with its resolved error message.

FieldLimit


required: boolean

Defined in: packages/core/src/fields/baseTypes.ts:569

Whether this field is required in the database schema.

BaseField.required


readonly type: "relationship"

Defined in: packages/core/src/fields/relationship/types.ts:146

optional validate(props): void | Promise<void>

Defined in: packages/core/src/fields/relationship/types.ts:160

Server-only async validation with value typed as string[].

FieldValidateProps<TCollectionSlug, string[]>

void | Promise<void>

FieldValidate

BaseField.validate