Page Contents

Home > @loopback/repository > ModelDefinition > hasMany

ModelDefinition.hasMany() method

Define a new hasMany relation.

Signature:

hasMany(name: string, definition: Omit<HasManyDefinition, 'name' | 'type' | 'targetsMany'>): this;

Parameters

Parameter Type Description
name string The name of the hasMany relation.
definition Omit<HasManyDefinition, ‘name’ | ‘type’ | ‘targetsMany’> The definition of the hasMany relation.

Returns:

this