@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
34 lines (24 loc) • 1.71 kB
Markdown
lang: en
title: 'API docs: repository.belongstodefinition'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/repository
permalink: /doc/en/lb4/apidocs.repository.belongstodefinition.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/repository](./repository.md) > [BelongsToDefinition](./repository.belongstodefinition.md)
## BelongsToDefinition interface
**Signature:**
```typescript
export interface BelongsToDefinition extends RelationDefinitionBase
```
**Extends:** [RelationDefinitionBase](./repository.relationdefinitionbase.md)
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [keyFrom?](./repository.belongstodefinition.keyfrom.md) | | string | _(Optional)_ |
| [keyTo?](./repository.belongstodefinition.keyto.md) | | string | _(Optional)_ |
| [polymorphic?](./repository.belongstodefinition.polymorphic.md) | | boolean \| { discriminator: string; } | _(Optional)_ The polymorphism of the target model. The discriminator is a key of source model. If the target model is not polymorphic, then the value should be left undefined or false; If the key on source model indicating the concrete class of the target instance is default i.e. camelCase(classNameOf(throughModelInstance)) + "Id" Then the discriminator field can be undefined |
| [targetsMany](./repository.belongstodefinition.targetsmany.md) | | false | |
| [type](./repository.belongstodefinition.type.md) | | [RelationType.belongsTo](./repository.relationtype.md) | |