# query.needNesting() function · @imqueue/pg-sequelize

Source: https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.query.neednesting/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/pg-sequelize 4.2.0 — generated reference, not hand-written

Whether a fields map asks for any of the model's relations.

**Signature:**

```typescript
export function needNesting(model: typeof Model, fields: any): boolean;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| model | typeof Model | Model whose associations to check against. |
| fields | any | Requested fields map. |


**Returns:**

boolean

`true` when at least one key names an association.

## Remarks

The cheap test for "does this query need joins at all", used to avoid building an `include` when the caller only wants columns.

