Skip to main content

Interface: GenericDatabaseWriterWithTable<DataModel>

server.GenericDatabaseWriterWithTable

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

Convex 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 Convex Guide for the guarantees Convex provides your functions.

If you're using code generation, use the DatabaseReader type in convex/_generated/server.d.ts which is typed for your data model.

Type parameters

NameType
DataModelextends GenericDataModel

Hierarchy

Properties

system

system: BaseDatabaseReaderWithTable<SystemDataModel>

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

The two entry points are:

  • get, which fetches a single document by its GenericId.
  • query, which starts building a query.

Inherited from

GenericDatabaseReaderWithTable.system

Defined in

server/database.ts:132

Methods

table

table<TableName>(tableName): BaseTableWriter<DataModel, TableName>

Scope the database to a specific table.

Type parameters

NameType
TableNameextends string

Parameters

NameType
tableNameTableName

Returns

BaseTableWriter<DataModel, TableName>

Overrides

GenericDatabaseReaderWithTable.table

Defined in

server/database.ts:219