Complex include options
The alias of the association. Used along with IncludeOptions.model.
This must be specified if the association has an alias (i.e. "as" was used when defining the association).
belongsTo, this should be the singular name, and for
it should be the plural.
The association you want to eagerly load. Either one of the values available in Model.associations, or the name of the association.
This can be used instead of providing a model/as pair.
This is the recommended method.
If an array: a list of the attributes that you want to select.
Attributes can also be raw SQL (
To rename an attribute, you can pass an array, with two elements:
include is used: selects all the attributes of the model,
plus some additional ones. Useful for aggregations.
Mark the include as duplicating, will prevent a subquery from being used.
Load further nested related models
Only available when setting IncludeOptions.separate to true.
The model you want to eagerly load.
We recommend specifying IncludeOptions.association instead.
ON clause, overrides default.
Whether to bind the ON and WHERE clause together by OR instead of AND.
Order include. Only available when setting
separate to true.
If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will be returned.
Only applies if InitOptions.paranoid is true for the model.
If true, converts to an inner join, which means that the parent model will only be loaded if it has any matching children.
include.where is set, false otherwise.
If true, converts to a right join if dialect support it.
Incompatible with IncludeOptions.required.
If true, runs a separate query to fetch the associated instances.
Use sub queries. This should only be used if you know for sure the query does not result in a cartesian product.
Where clauses to apply to the child model
Note that this converts the eager load to an inner join, unless you explicitly set IncludeOptions.required to false
Generated using TypeDoc