Page Contents

Home > @loopback/repository > HasOneDefinition > keyTo

HasOneDefinition.keyTo property

The foreign key used by the target model.

E.g. when a Customer has one Address instance, 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;