@loopback/docs
Version:
Documentation for LoopBack 4
29 lines (19 loc) • 1.03 kB
Markdown
---
lang: en
title: 'API docs: repository.hasonedefinition'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.repository.hasonedefinition.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/repository](./repository.md) > [HasOneDefinition](./repository.hasonedefinition.md)
## HasOneDefinition interface
<b>Signature:</b>
```typescript
export interface HasOneDefinition extends RelationDefinitionBase
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [keyTo](./repository.hasonedefinition.keyto.md) | <code>string</code> | 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". |
| [type](./repository.hasonedefinition.type.md) | <code>RelationType.hasOne</code> | |