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