Page Contents
Home > @loopback/repository > ModelDefinition > hasOne
ModelDefinition.hasOne() method
Define a new hasOne relation.
Signature:
hasOne(name: string, definition: Omit<HasOneDefinition, 'name' | 'type' | 'targetsMany'>): this;
Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string | The name of the hasOne relation. |
| definition | Omit<HasOneDefinition, ‘name’ | ‘type’ | ‘targetsMany’> | The definition of the hasOne relation. |
Returns:
this