Page Contents

Home > @loopback/repository > HasManyDefinition > keyTo

HasManyDefinition.keyTo property

The foreign key used by the target model.

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”.

Signature:

keyTo?: string;