> For the complete documentation index, see [llms.txt](https://ra-libs.gitbook.io/nestjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ra-libs.gitbook.io/nestjs/utils/includerelations.md).

# includeRelations

Include relations specific fields or all fields depending on the input.

## Usage

```typescript
import { includeReferencesIDs, transformOutputArraysToIds } from '@ra-libs/nestjs'

@Injectable()
export class Service {

    private relations = ["client", "seller.firstName"]

    findAll(query: any) {
        query = includeRelations(query, this.relations)
        ...
    }
}
```

the includeRelations used above will return a JSON

```typescript
{
    ...query,
    include: {
        "client": true,
        "seller.select.firstName": true
    }
}
```
