Skip to content

getIncomingRelationships

getIncomingRelationships(props): IncomingRelationship[]

Defined in: packages/core/src/collections/validator.ts:40

Returns all relationship fields in other collections that point to collection.

Iterates every collection in config (excluding collection itself) and collects any field with type === "relationship" whose collection matches props.collection.slug.

Input props.

CollectionConfig

The collection being checked for incoming relationships.

VexConfig

The full resolved VexCMS configuration.

IncomingRelationship[]

An array of IncomingRelationship descriptors, empty if none found.

// posts has: author: relationship({ collection: "authors" })
getIncomingRelationships({ collection: authorsCollection, config })
// → [{ fromSlug: "posts", fieldKey: "author" }]