query.getInclude() function
Finds the include options for a model reached through a chain of includes.
Signature:
export function getInclude(queryOptions: FindOptions, path: (typeof Model)[]): IncludeOptions | null;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
queryOptions |
FindOptions |
Query to search. |
|
path |
(typeof Model)[] |
Models to follow, outermost first. |
Returns:
IncludeOptions | null
The matching include options, or null when the path does not resolve.
Remarks
The way to reach into a query that is already built — to add a where clause to a join, say, without rebuilding the whole thing. The path is walked one model at a time, and it is CONSUMED as that happens, so pass a copy if the caller still needs it.