Interface: BaseTableWriter<DataModel, TableName>
server.BaseTableWriter
Type parameters
Name | Type |
---|---|
DataModel | extends GenericDataModel |
TableName | extends TableNamesInDataModel <DataModel > |
Hierarchy
-
BaseTableReader
<DataModel
,TableName
>↳
BaseTableWriter
Methods
get
▸ get(id
): Promise
<null
| DocumentByName
<DataModel
, TableName
>>
Fetch a single document from the table by its GenericId.
Parameters
Name | Type | Description |
---|---|---|
id | GenericId <TableName > | The GenericId of the document to fetch from the database. |
Returns
Promise
<null
| DocumentByName
<DataModel
, TableName
>>
- The GenericDocument of the document at the given GenericId, or
null
if it no longer exists.
Inherited from
Defined in
query
▸ query(): QueryInitializer
<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
QueryInitializer
<NamedTableInfo
<DataModel
, TableName
>>
- A QueryInitializer object to start building a query.
Inherited from
Defined in
insert
▸ insert(value
): Promise
<GenericId
<TableName
>>
Insert a new document into the table.
Parameters
Name | Type | Description |
---|---|---|
value | WithoutSystemFields <DocumentByName <DataModel , TableName >> | The Value to insert into the given table. |
Returns
Promise
<GenericId
<TableName
>>
- GenericId of the new document.
Defined in
patch
▸ patch(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.
Parameters
Name | Type | Description |
---|---|---|
id | GenericId <TableName > | The GenericId of the document to patch. |
value | Partial <DocumentByName <DataModel , TableName >> | The partial GenericDocument to merge into the specified document. If this new value specifies system fields like _id , they must match the document's existing field values. |
Returns
Promise
<void
>
Defined in
replace
▸ replace(id
, value
): Promise
<void
>
Replace the value of an existing document, overwriting its old value.
Parameters
Name | Type | Description |
---|---|---|
id | GenericId <TableName > | The GenericId of the document to replace. |
value | WithOptionalSystemFields <DocumentByName <DataModel , TableName >> | The new GenericDocument for the document. This value can omit the system fields, and the database will fill them in. |
Returns
Promise
<void
>
Defined in
delete
▸ delete(id
): Promise
<void
>
Delete an existing document.
Parameters
Name | Type | Description |
---|---|---|
id | GenericId <TableName > | The GenericId of the document to remove. |
Returns
Promise
<void
>