> ## 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: IndexRangeBuilder<Document, IndexFields, FieldNum>

> Builder to define an index range to query.

[server](/api/modules/server).IndexRangeBuilder

Builder to define an index range to query.

An index range is a description of which documents Bijection should consider
when running the query.

An index range is always a chained list of:

1. 0 or more equality expressions defined with `.eq`.
2. \[Optionally] A lower bound expression defined with `.gt` or `.gte`.
3. \[Optionally] An upper bound expression defined with `.lt` or `.lte`.

**You must step through fields in index order.**

Each equality expression must compare a different index field, starting from
the beginning and in order. The upper and lower bounds must follow the
equality expressions and compare the next field.

For example, if there is an index of messages on
`["projectId", "priority"]`, a range searching for "messages in 'myProjectId'
with priority at least 100" would look like:

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
q.eq("projectId", myProjectId)
 .gte("priority", 100)
```

**The performance of your query is based on the specificity of the range.**

This class is designed to only allow you to specify ranges that Bijection can
efficiently use your index to find. For all other filtering use
[filter](/api/interfaces/server.OrderedQuery#filter).

To learn about indexes, see [Indexes](/database/reading-data/indexes/indexes).

## Type parameters

| Name | Type |
| :- | :- |
| `Document` | extends [`GenericDocument`](/api/modules/server#genericdocument) |
| `IndexFields` | extends [`GenericIndexFields`](/api/modules/server#genericindexfields) |
| `FieldNum` | extends `number` = `0` |

## Hierarchy

* `LowerBoundIndexRangeBuilder`\<`Document`, `IndexFields`\[`FieldNum`]>

  ↳ **`IndexRangeBuilder`**

## Methods

### eq

▸ **eq**(`fieldName`, `value`): `NextIndexRangeBuilder`\<`Document`, `IndexFields`, `FieldNum`>

Restrict this range to documents where `doc[fieldName] === value`.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `fieldName` | `IndexFields`\[`FieldNum`] | The name of the field to compare. Must be the next field in the index. |
| `value` | [`FieldTypeFromFieldPath`](/api/modules/server#fieldtypefromfieldpath)\<`Document`, `IndexFields`\[`FieldNum`]> | The value to compare against. |

#### Returns

`NextIndexRangeBuilder`\<`Document`, `IndexFields`, `FieldNum`>

***

### gt

▸ **gt**(`fieldName`, `value`): `UpperBoundIndexRangeBuilder`\<`Document`, `IndexFields`\[`FieldNum`]>

Restrict this range to documents where `doc[fieldName] > value`.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `fieldName` | `IndexFields`\[`FieldNum`] | The name of the field to compare. Must be the next field in the index. |
| `value` | [`FieldTypeFromFieldPath`](/api/modules/server#fieldtypefromfieldpath)\<`Document`, `IndexFields`\[`FieldNum`]> | The value to compare against. |

#### Returns

`UpperBoundIndexRangeBuilder`\<`Document`, `IndexFields`\[`FieldNum`]>

#### Inherited from

LowerBoundIndexRangeBuilder.gt

***

### gte

▸ **gte**(`fieldName`, `value`): `UpperBoundIndexRangeBuilder`\<`Document`, `IndexFields`\[`FieldNum`]>

Restrict this range to documents where `doc[fieldName] >= value`.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `fieldName` | `IndexFields`\[`FieldNum`] | The name of the field to compare. Must be the next field in the index. |
| `value` | [`FieldTypeFromFieldPath`](/api/modules/server#fieldtypefromfieldpath)\<`Document`, `IndexFields`\[`FieldNum`]> | The value to compare against. |

#### Returns

`UpperBoundIndexRangeBuilder`\<`Document`, `IndexFields`\[`FieldNum`]>

#### Inherited from

LowerBoundIndexRangeBuilder.gte

***

### lt

▸ **lt**(`fieldName`, `value`): [`IndexRange`](/api/classes/server.IndexRange)

Restrict this range to documents where `doc[fieldName] < value`.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `fieldName` | `IndexFields`\[`FieldNum`] | The name of the field to compare. Must be the same index field used in the lower bound (`.gt` or `.gte`) or the next field if no lower bound was specified. |
| `value` | [`FieldTypeFromFieldPath`](/api/modules/server#fieldtypefromfieldpath)\<`Document`, `IndexFields`\[`FieldNum`]> | The value to compare against. |

#### Returns

[`IndexRange`](/api/classes/server.IndexRange)

#### Inherited from

LowerBoundIndexRangeBuilder.lt

***

### lte

▸ **lte**(`fieldName`, `value`): [`IndexRange`](/api/classes/server.IndexRange)

Restrict this range to documents where `doc[fieldName] <= value`.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `fieldName` | `IndexFields`\[`FieldNum`] | The name of the field to compare. Must be the same index field used in the lower bound (`.gt` or `.gte`) or the next field if no lower bound was specified. |
| `value` | [`FieldTypeFromFieldPath`](/api/modules/server#fieldtypefromfieldpath)\<`Document`, `IndexFields`\[`FieldNum`]> | The value to compare against. |

#### Returns

[`IndexRange`](/api/classes/server.IndexRange)

#### Inherited from

LowerBoundIndexRangeBuilder.lte
