@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
26 lines (18 loc) • 1.14 kB
Markdown
lang: en
title: 'API docs: repository.belongstodefinition.polymorphic'
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.polymorphic.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/repository](./repository.md) > [BelongsToDefinition](./repository.belongstodefinition.md) > [polymorphic](./repository.belongstodefinition.polymorphic.md)
## BelongsToDefinition.polymorphic property
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
**Signature:**
```typescript
polymorphic?: boolean | {
discriminator: string;
};
```