UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

36 lines (23 loc) 1.11 kB
--- lang: en title: 'API docs: repository.modeldefinition.hasone' 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.modeldefinition.hasone.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [ModelDefinition](./repository.modeldefinition.md) &gt; [hasOne](./repository.modeldefinition.hasone.md) ## ModelDefinition.hasOne() method Define a new hasOne relation. <b>Signature:</b> ```typescript hasOne(name: string, definition: Omit<HasOneDefinition, 'name' | 'type' | 'targetsMany'>): this; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | name | string | The name of the hasOne relation. | | definition | Omit&lt;[HasOneDefinition](./repository.hasonedefinition.md)<!-- -->, 'name' \| 'type' \| 'targetsMany'&gt; | The definition of the hasOne relation. | <b>Returns:</b> this