Page Contents

Home > @loopback/repository > HasManyDefinition > through

HasManyDefinition.through property

Description of the through model of the hasManyThrough relation.

A hasManyThrough relation defines a many-to-many connection with another model. This relation indicates that the declaring model can be matched with zero or more instances of another model by proceeding through a third model.

E.g a Category has many Products, and a Product can have many Categories. CategoryProductLink can be the through model. Such a through model has information of foreign keys of the source model(Category) and the target model(Product).

Warning: The hasManyThrough interface is experimental and is subject to change. If backwards-incompatible changes are made, a new major version may not be released.


through?: {
        model: TypeResolver<Entity, typeof Entity>;
        keyFrom?: string;
        keyTo?: string;
        polymorphic?: boolean | {
            discriminator: string;