> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Interface: RelationRead<Row, Indexes, Paginated, Ordered>

> Reference for the RelationRead interface in bijection/server.

[server](https://docs.bijection.com/api/modules/server).RelationRead

## Type parameters

| Name | Type |
| :- | :- |
| `Row` | `Row` |
| `Indexes` | extends [`ReadIndexes`](https://docs.bijection.com/api/modules/server#readindexes) = \{} |
| `Paginated` | extends `boolean` = `boolean` |
| `Ordered` | extends `boolean` = `boolean` |

## Methods

### explain

▸ **explain**(): `Promise`\<[`RelationReadExplanation`](https://docs.bijection.com/api/modules/server#relationreadexplanation)>

Inspect schema admission, pagination and maintenance without reading source rows.

#### Returns

`Promise`\<[`RelationReadExplanation`](https://docs.bijection.com/api/modules/server#relationreadexplanation)>

***

### paginate

▸ **paginate**(`options`): `Promise`\<[`PaginationResult`](https://docs.bijection.com/api/interfaces/server.PaginationResult)\<`Row`>>

#### Parameters

| Name | Type |
| :- | :- |
| `options` | `Paginated` extends `false` ? `never` : [`PaginationOptions`](https://docs.bijection.com/api/interfaces/server.PaginationOptions) |

#### Returns

`Promise`\<[`PaginationResult`](https://docs.bijection.com/api/interfaces/server.PaginationResult)\<`Row`>>

***

### withIndex

▸ **withIndex**\<`Index`>(`index`, `range?`): [`RelationRead`](https://docs.bijection.com/api/interfaces/server.RelationRead)\<`Row`, `Indexes`, `Paginated`, `true`>

Read through a declared index; fields follow its order and value types.

#### Type parameters

| Name | Type |
| :- | :- |
| `Index` | extends keyof `Indexes` & `string` |

#### Parameters

| Name | Type |
| :- | :- |
| `index` | `Index` |
| `range?` | (`q`: [`RelationIndexRange`](https://docs.bijection.com/api/interfaces/server.RelationIndexRange)\<`Row`, `Indexes`\[`Index`]>) => [`RelationIndexRangeEnd`](https://docs.bijection.com/api/interfaces/server.RelationIndexRangeEnd)\<`any`> |

#### Returns

[`RelationRead`](https://docs.bijection.com/api/interfaces/server.RelationRead)\<`Row`, `Indexes`, `Paginated`, `true`>

***

### order

▸ **order**(`direction`): [`RelationRead`](https://docs.bijection.com/api/interfaces/server.RelationRead)\<`Row`, `Indexes`, `Paginated`, `Ordered`>

Reverse an existing order. An unordered relation requires orderBy in its definition.

#### Parameters

| Name | Type |
| :- | :- |
| `direction` | `Ordered` extends `false` ? `never` : `"asc"` \| `"desc"` |

#### Returns

[`RelationRead`](https://docs.bijection.com/api/interfaces/server.RelationRead)\<`Row`, `Indexes`, `Paginated`, `Ordered`>

***

### collect

▸ **collect**(): `Promise`\<`Row`\[]>

#### Returns

`Promise`\<`Row`\[]>

***

### take

▸ **take**(`count`): `Promise`\<`Row`\[]>

#### Parameters

| Name | Type |
| :- | :- |
| `count` | `number` |

#### Returns

`Promise`\<`Row`\[]>

***

### first

▸ **first**(): `Promise`\<`Row` | `null`>

#### Returns

`Promise`\<`Row` | `null`>

***

### unique

▸ **unique**(): `Promise`\<`Row` | `null`>

#### Returns

`Promise`\<`Row` | `null`>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.