> ## 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: GenericDatabaseWriterWithTable<DataModel>

> An interface to read from and write to the database within Bijection mutation functions.

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

An interface to read from and write to the database within Bijection mutation
functions.

You should generally use the `DatabaseWriter` type from
`"./_generated/server"`.

Bijection guarantees that all writes within a single mutation are
executed atomically, so you never have to worry about partial writes leaving
your data in an inconsistent state. See [the Bijection Guide](/functions/query-functions)
for the guarantees Bijection provides your functions.

## Type parameters

| Name | Type |
| :- | :- |
| `DataModel` | extends [`GenericDataModel`](/api/modules/server#genericdatamodel) |

## Hierarchy

* [`GenericDatabaseReaderWithTable`](/api/interfaces/server.GenericDatabaseReaderWithTable)\<`DataModel`>

  ↳ **`GenericDatabaseWriterWithTable`**

## Properties

### system

• **system**: `BaseDatabaseReaderWithTable`\<[`SystemDataModel`](/api/interfaces/server.SystemDataModel)>

An interface to read from the system tables within Bijection query functions

The two entry points are:

* [get](/api/interfaces/server.GenericDatabaseReader#get), which fetches a single document
  by its [GenericId](/api/modules/values#genericid).
* [query](/api/interfaces/server.GenericDatabaseReader#query), which starts building a query.

#### Inherited from

[GenericDatabaseReaderWithTable](/api/interfaces/server.GenericDatabaseReaderWithTable).[system](/api/interfaces/server.GenericDatabaseReaderWithTable#system)

## Methods

### table

▸ **table**\<`TableName`>(`tableName`): `DataModel`\[`TableName`] extends \{ `isWritable`: `false`  } ? [`BaseTableReader`](/api/interfaces/server.BaseTableReader)\<`DataModel`, `TableName`> : [`BaseTableWriter`](/api/interfaces/server.BaseTableWriter)\<`DataModel`, `TableName`>

Scope the database to a specific table.

#### Type parameters

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

#### Parameters

| Name | Type |
| :- | :- |
| `tableName` | `TableName` |

#### Returns

`DataModel`\[`TableName`] extends \{ `isWritable`: `false`  } ? [`BaseTableReader`](/api/interfaces/server.BaseTableReader)\<`DataModel`, `TableName`> : [`BaseTableWriter`](/api/interfaces/server.BaseTableWriter)\<`DataModel`, `TableName`>

#### Overrides

[GenericDatabaseReaderWithTable](/api/interfaces/server.GenericDatabaseReaderWithTable).[table](/api/interfaces/server.GenericDatabaseReaderWithTable#table)
