The model to include
OptionalasAlias for the included model. Used as:
OptionalwhereOptionalattributesOptionalschemaSchema to use for the included model
OptionalrequiredOptionalthroughFor many-to-many (belongsToMany) relationships, specify the junction table model. This is required when including models through a join table.
Optionalmodel?: ModelStatic<any>The junction/through model
Optionalas?: stringAlias for the through model in SQL
Optionalattributes?: string[] | { include?: string[]; exclude?: string[] }Attributes to include from the through model
Optionalwhere?: WhereOptions<any>Where conditions on the through model
Optionalrequired?: booleanWhether to require the join (INNER JOIN vs LEFT JOIN)
OptionalonOptionalorderOptionallimitOptionaloffsetOptionalparanoidOptionalnestedWhen true, includes nested associations recursively
OptionalallInclude all associations, or a string to filter by association name
OptionalincludeIgnore attributes from included models (default: true)
OptionalforeignCustom foreign key for the join. Can be a single string for simple foreign keys, or an array for composite foreign keys.
OptionalincludeNested includes
OptionalduplicatingWhether to duplicate parent rows for each child (for hasMany)
OptionalduplicateAllow duplicate column names in the result. When true, uses table aliases to distinguish columns
OptionaltargetTarget key for the association (defaults to primary key). Can be a single string for simple keys, or an array for composite keys.
OptionaljoinType of JOIN to use.
OptionallateralWhether to use LATERAL JOIN (PostgreSQL only). LATERAL allows subqueries to reference columns from preceding tables.
OptionalantiWhether to use anti-join pattern (NOT EXISTS or LEFT JOIN WHERE NULL). This finds records that do not have related records in the included model.
OptionalexcludeAlias for antiJoin - when true, uses anti-join pattern.
OptionalantiType of anti-join to use.
OptionalapplyWhether to use CROSS APPLY or OUTER APPLY (SQL Server only).
OptionallateralInline lateral subquery for advanced use cases. Allows defining an inline subquery that can reference columns from preceding tables.
The model for the lateral subquery
Optionalwhere?: WhereOptions<any>WHERE conditions on the subquery
Optionalattributes?: string[] | { include?: string[]; exclude?: string[] }Attributes to select from the subquery
A single eager-loaded association: which one, what to select from it, whether it filters the parent (
required), and any nesting beneath it.