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.
Parameters
Section titled “Parameters”Input props.
collection
Section titled “collection”The collection being checked for incoming relationships.
config
Section titled “config”The full resolved VexCMS configuration.
Returns
Section titled “Returns”An array of IncomingRelationship descriptors, empty if none found.
Example
Section titled “Example”// posts has: author: relationship({ collection: "authors" })getIncomingRelationships({ collection: authorsCollection, config })// → [{ fromSlug: "posts", fieldKey: "author" }]