> ## 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: SetQuery<TableInfo>

> Reference for the SetQuery interface in bijection/server.

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

## Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](https://docs.bijection.com/api/modules/server#generictableinfo) |

## Hierarchy

* `AsyncIterable`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>

  ↳ **`SetQuery`**

## Methods

### require

▸ **require**(`requirement`): [`SetQuery`](https://docs.bijection.com/api/interfaces/server.SetQuery)\<`TableInfo`>

#### Parameters

| Name | Type |
| :- | :- |
| `requirement` | [`SourceReadRequirement`](https://docs.bijection.com/api/modules/server#sourcereadrequirement) |

#### Returns

[`SetQuery`](https://docs.bijection.com/api/interfaces/server.SetQuery)\<`TableInfo`>

***

### knownRecords

▸ **knownRecords**(): [`SetQuery`](https://docs.bijection.com/api/interfaces/server.SetQuery)\<`TableInfo`>

#### Returns

[`SetQuery`](https://docs.bijection.com/api/interfaces/server.SetQuery)\<`TableInfo`>

***

### aggregate

▸ **aggregate**\<`Measures`, `By`>(`measures`, `options?`): `Promise`\<[`QueryAggregateOutput`](https://docs.bijection.com/api/modules/server#queryaggregateoutput)\<`TableInfo`, `Measures`, `By`>>

#### Type parameters

| Name | Type |
| :- | :- |
| `Measures` | extends [`QueryAggregateMeasures`](https://docs.bijection.com/api/modules/server#queryaggregatemeasures)\<`TableInfo`> |
| `By` | extends readonly [`DocumentFields`](https://docs.bijection.com/api/modules/server#documentfields)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>\[] \| `undefined` = `undefined` |

#### Parameters

| Name | Type |
| :- | :- |
| `measures` | `Measures` |
| `options?` | `Object` |
| `options.by` | `By` |

#### Returns

`Promise`\<[`QueryAggregateOutput`](https://docs.bijection.com/api/modules/server#queryaggregateoutput)\<`TableInfo`, `Measures`, `By`>>

***

### where

▸ **where**(`predicate`): [`SetQuery`](https://docs.bijection.com/api/interfaces/server.SetQuery)\<`TableInfo`>

#### Parameters

| Name | Type |
| :- | :- |
| `predicate` | (`row`: [`SpatialRow`](https://docs.bijection.com/api/modules/server#spatialrow)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>) => [`ExpressionOrValue`](https://docs.bijection.com/api/modules/server#expressionorvalue)\<`boolean`> |

#### Returns

[`SetQuery`](https://docs.bijection.com/api/interfaces/server.SetQuery)\<`TableInfo`>

***

### filter

▸ **filter**(`predicate`): [`SetQuery`](https://docs.bijection.com/api/interfaces/server.SetQuery)\<`TableInfo`>

#### Parameters

| Name | Type |
| :- | :- |
| `predicate` | (`q`: [`FilterBuilder`](https://docs.bijection.com/api/interfaces/server.FilterBuilder)\<`TableInfo`>) => [`ExpressionOrValue`](https://docs.bijection.com/api/modules/server#expressionorvalue)\<`boolean`> |

#### Returns

[`SetQuery`](https://docs.bijection.com/api/interfaces/server.SetQuery)\<`TableInfo`>

***

### collect

▸ **collect**(): `Promise`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>\[]>

#### Returns

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

***

### collectWithDiagnostics

▸ **collectWithDiagnostics**(): `Promise`\<\{ `rows`: [`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>\[] ; `diagnostics`: [`SpatialReadDiagnostics`](https://docs.bijection.com/api/modules/server#spatialreaddiagnostics) ; `execution`: [`ReadExecutionDiagnostics`](https://docs.bijection.com/api/modules/server#readexecutiondiagnostics)  }>

Execute with whole-population authorization and native work counters.

#### Returns

`Promise`\<\{ `rows`: [`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>\[] ; `diagnostics`: [`SpatialReadDiagnostics`](https://docs.bijection.com/api/modules/server#spatialreaddiagnostics) ; `execution`: [`ReadExecutionDiagnostics`](https://docs.bijection.com/api/modules/server#readexecutiondiagnostics)  }>

***

### paginate

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

#### Parameters

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

#### Returns

`Promise`\<[`PaginationResult`](https://docs.bijection.com/api/interfaces/server.PaginationResult)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>>

***

### readPage

▸ **readPage**(`options`): `Promise`\<[`QueryReadPage`](https://docs.bijection.com/api/modules/server#queryreadpage)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>>

#### Parameters

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

#### Returns

`Promise`\<[`QueryReadPage`](https://docs.bijection.com/api/modules/server#queryreadpage)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>>

***

### nearest

▸ **nearest**(`origin`, `options`): `Promise`\<\{ `doc`: [`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`> ; `distance_m`: `number`  }\[]>

Order by reported point distance. Refuse if global ordering cannot be
established within the native work budget. Requires a spatial index.

#### Parameters

| Name | Type |
| :- | :- |
| `origin` | [`Point`](https://docs.bijection.com/api/modules/values#point) |
| `options` | `Object` |
| `options.limit` | `number` |
| `options.max_distance_m?` | `number` |
| `options.field` | [`NearestField`](https://docs.bijection.com/api/modules/server#nearestfield)\<`TableInfo`> |

#### Returns

`Promise`\<\{ `doc`: [`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`> ; `distance_m`: `number`  }\[]>

***

### nearestWithDiagnostics

▸ **nearestWithDiagnostics**(`origin`, `options`): `Promise`\<\{ `rows`: \{ `doc`: [`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`> ; `distance_m`: `number`  }\[] ; `diagnostics`: \{ `work`: [`SpatialReadDiagnostics`](https://docs.bijection.com/api/modules/server#spatialreaddiagnostics) ; `execution`: [`ReadExecutionDiagnostics`](https://docs.bijection.com/api/modules/server#readexecutiondiagnostics) ; `cells_visited`: `number` ; `cells_subdivided`: `number` ; `index_probes`: `number` ; `rows_ranked`: `number` ; `unique_documents_ranked`: `number` ; `rows_read`: `number` ; `bytes_read`: `number` ; `frontier_peak`: `number`  }  }>

The same exact answer with native work counters. This stronger read
requires authorization for the whole candidate range, including rows
ordinary selective reads could withhold.

#### Parameters

| Name | Type |
| :- | :- |
| `origin` | [`Point`](https://docs.bijection.com/api/modules/values#point) |
| `options` | `Object` |
| `options.limit` | `number` |
| `options.max_distance_m?` | `number` |
| `options.field` | [`NearestField`](https://docs.bijection.com/api/modules/server#nearestfield)\<`TableInfo`> |

#### Returns

`Promise`\<\{ `rows`: \{ `doc`: [`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`> ; `distance_m`: `number`  }\[] ; `diagnostics`: \{ `work`: [`SpatialReadDiagnostics`](https://docs.bijection.com/api/modules/server#spatialreaddiagnostics) ; `execution`: [`ReadExecutionDiagnostics`](https://docs.bijection.com/api/modules/server#readexecutiondiagnostics) ; `cells_visited`: `number` ; `cells_subdivided`: `number` ; `index_probes`: `number` ; `rows_ranked`: `number` ; `unique_documents_ranked`: `number` ; `rows_read`: `number` ; `bytes_read`: `number` ; `frontier_peak`: `number`  }  }>

***

### \[asyncIterator]

▸ **\[asyncIterator]**(): `AsyncIterator`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>, `any`, `any`>

#### Returns

`AsyncIterator`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>, `any`, `any`>

#### Inherited from

AsyncIterable.\[asyncIterator]


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