Skip to main content
server.BijectionDatabaseWriter Not exported: an exported type refers to it.

Type parameters

Hierarchy

Properties

system

• system: BaseDatabaseReader<SystemDataModel> An interface to read from the system tables within Bijection query functions. System tables include _storage (file metadata) and _scheduled_functions (scheduled function state). Use ctx.db.system.get() and ctx.db.system.query() just like regular tables. Example

Inherited from

GenericDatabaseWriter.system

vars

• vars: Object Values that are not known until the mutation commits.

Type declaration

Inherited from

GenericDatabaseWriter.vars

Methods

erase

▸ erase(id): Promise<void>

Parameters

Returns

Promise<void>

get

▸ get<TableName, Fields>(table, id, options): Promise<null | SelectedDocument<DocumentByName<DataModel, TableName>, Fields>> Fetch selected top-level properties, retaining _id and _creationTime. Property and object access is enforced before disclosure. Null means the document is absent; refused access is an error, never a redacted document.

Type parameters

Parameters

Returns

Promise<null | SelectedDocument<DocumentByName<DataModel, TableName>, Fields>>

Inherited from

GenericDatabaseWriter.get ▸ get<TableName>(table, id): Promise<null | DocumentByName<DataModel, TableName>> Fetch a single document from the database by table name and GenericId. Example

Type parameters

Parameters

Returns

Promise<null | DocumentByName<DataModel, TableName>>

Inherited from

GenericDatabaseWriter.get ▸ get<TableName>(id): Promise<null | DocumentByName<DataModel, TableName>> Fetch a single document from the database by its GenericId. Supported for backwards compatibility. Prefer db.get(tableName, id) in new code, or db.system.get(tableName, id) for system tables.

Type parameters

Parameters

Returns

Promise<null | DocumentByName<DataModel, TableName>>

Inherited from

GenericDatabaseWriter.get

query

▸ query<TableName>(tableName): SelectableQueryInitializer<NamedTableInfo<DataModel, TableName>> Begin a query for the given table name. Queries don’t execute immediately, so calling this method and extending its query are free until the results are actually used.

Type parameters

Parameters

Returns

SelectableQueryInitializer<NamedTableInfo<DataModel, TableName>>

Inherited from

GenericDatabaseWriter.query

normalizeId

▸ normalizeId<TableName>(tableName, id): null | TableKey<DataModel, TableName> Returns the string ID format for the ID in a given table, or null if the ID is from a different table or is not a valid ID. This accepts the string ID format as well as the .toString() representation of the legacy class-based ID format. This does not guarantee that the ID exists (i.e. db.get(tableName, id) may return null).

Type parameters

Parameters

Returns

null | TableKey<DataModel, TableName>

Inherited from

GenericDatabaseWriter.normalizeId

insert

▸ insert<TableName>(table, value): Promise<GenericId<TableName>> Insert a new document into a table. Example

Type parameters

Parameters

Returns

Promise<GenericId<TableName>> The GenericId of the new document.

Inherited from

GenericDatabaseWriter.insert

patch

▸ patch<TableName>(table, id, value): Promise<void> Patch an existing document, shallow merging it with the given partial document. New fields are added. Existing fields are overwritten. Fields set to undefined are removed. Fields not specified in the patch are left unchanged. This method will throw if the document does not exist. Example
Tip: Use patch for partial updates. Use replace when you want to overwrite the entire document.

Type parameters

Parameters

Returns

Promise<void>

Inherited from

GenericDatabaseWriter.patch ▸ patch<TableName>(id, value): Promise<void> Patch an existing document, shallow merging it with the given partial document. New fields are added. Existing fields are overwritten. Fields set to undefined are removed. Fields not specified in the patch are left unchanged. This method will throw if the document does not exist. Supported for backwards compatibility. Prefer db.patch(tableName, id, value) in new code.

Type parameters

Parameters

Returns

Promise<void>

Inherited from

GenericDatabaseWriter.patch

replace

▸ replace<TableName>(table, id, value): Promise<void> Replace the value of an existing document, overwriting its old value completely. Unlike patch, which does a shallow merge, replace overwrites the entire document. Any fields not included in the new value will be removed (except system fields _id and _creationTime). This method will throw if the document does not exist. Example

Type parameters

Parameters

Returns

Promise<void>

Inherited from

GenericDatabaseWriter.replace ▸ replace<TableName>(id, value): Promise<void> Replace the value of an existing document, overwriting its old value completely. Unlike patch, which does a shallow merge, replace overwrites the entire document. Supported for backwards compatibility. Prefer db.replace(tableName, id, value) in new code.

Type parameters

Parameters

Returns

Promise<void>

Inherited from

GenericDatabaseWriter.replace

delete

▸ delete<TableName>(table, id): Promise<void> Delete an existing document. Example

Type parameters

Parameters

Returns

Promise<void>

Inherited from

GenericDatabaseWriter.delete ▸ delete(id): Promise<void> Delete an existing document. Supported for backwards compatibility. Prefer db.delete(tableName, id) in new code. Note: Bijection queries do not support .delete() directly on query results. To delete multiple documents, .collect() them first, then delete each one individually.

Parameters

Returns

Promise<void>

Inherited from

GenericDatabaseWriter.delete
▸ related<Table, Name>(id, name): string extends keyof Schema ? any : RelatedQueryFor<DataModel, Navigations<Schema, Table>[Name & NavigationEntries<Schema, Table> extends { name: Name } ? Name : never], false> Follow a declared navigation. Construction performs no reads; a terminal resolves the name against the active schema and reads the complete answer under the caller’s authority, including the mutation’s pending writes.

Type parameters

Parameters

Returns

string extends keyof Schema ? any : RelatedQueryFor<DataModel, Navigations<Schema, Table>[Name & NavigationEntries<Schema, Table> extends { name: Name } ? Name : never], false>

Inherited from

RelatedReader.related