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.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.