Page Contents

Home > @loopback/repository > HasManyDefinition

HasManyDefinition interface

Signature:

export interface HasManyDefinition extends RelationDefinitionBase 

Properties

Property Type Description
keyFrom string  
keyTo string keyTo: The foreign key used by the target model for this relation. keyFrom: The source key used by the source model for this relation.E.g. when a Customer has many Order instances, then keyTo is “customerId”. Note that “customerId” is the default FK assumed by the framework, users can provide a custom FK name by setting “keyTo”. And Customer.id is keyFrom. keyFrom defaults to the id property of a model. Users can provide a custom source key name by setting “keyTo”.
targetsMany true  
type RelationType.hasMany