> ## 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: BaseTableReader<DataModel, TableName>

> Reference for the BaseTableReader interface in bijection/server.

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

## Type parameters

| Name | Type |
| :- | :- |
| `DataModel` | extends [`GenericDataModel`](/api/modules/server#genericdatamodel) |
| `TableName` | extends [`TableNamesInDataModel`](/api/modules/server#tablenamesindatamodel)\<`DataModel`> |

## Hierarchy

* **`BaseTableReader`**

  ↳ [`BaseTableWriter`](/api/interfaces/server.BaseTableWriter)

## Methods

### get

▸ **get**\<`Fields`>(`id`, `options`): `Promise`\<`null` | [`SelectedDocument`](/api/modules/server#selecteddocument)\<[`DocumentByName`](/api/modules/server#documentbyname)\<`DataModel`, `TableName`>, `Fields`>>

Read selected top-level properties, retaining identity and creation time.

#### Type parameters

| Name | Type |
| :- | :- |
| `Fields` | extends `string` |

#### Parameters

| Name | Type |
| :- | :- |
| `id` | [`TableKey`](/api/modules/server#tablekey)\<`DataModel`, `TableName`> |
| `options` | `Object` |
| `options.select` | readonly `Fields`\[] |

#### Returns

`Promise`\<`null` | [`SelectedDocument`](/api/modules/server#selecteddocument)\<[`DocumentByName`](/api/modules/server#documentbyname)\<`DataModel`, `TableName`>, `Fields`>>

▸ **get**(`id`): `Promise`\<`null` | [`DocumentByName`](/api/modules/server#documentbyname)\<`DataModel`, `TableName`>>

Fetch a single document from the table by its [GenericId](/api/modules/values#genericid).

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `id` | [`TableKey`](/api/modules/server#tablekey)\<`DataModel`, `TableName`> | The [GenericId](/api/modules/values#genericid) of the document to fetch from the database. |

#### Returns

`Promise`\<`null` | [`DocumentByName`](/api/modules/server#documentbyname)\<`DataModel`, `TableName`>>

* The [GenericDocument](/api/modules/server#genericdocument) of the document at the given [GenericId](/api/modules/values#genericid), or `null` if it no longer exists.

***

### query

▸ **query**(): [`SelectableQueryInitializer`](/api/interfaces/server.SelectableQueryInitializer)\<[`NamedTableInfo`](/api/modules/server#namedtableinfo)\<`DataModel`, `TableName`>>

Begin a query for the table.

Queries don't execute immediately, so calling this method and extending its
query are free until the results are actually used.

#### Returns

[`SelectableQueryInitializer`](/api/interfaces/server.SelectableQueryInitializer)\<[`NamedTableInfo`](/api/modules/server#namedtableinfo)\<`DataModel`, `TableName`>>

* A [QueryInitializer](/api/interfaces/server.QueryInitializer) object to start building a query.
