interface ICosmosItem
Since 0.2.0

A structural subset of the SDK Item handle — one document addressed by its id and partition key.

Methods

read(): Promise<CosmosItemResponse<Record<string, unknown>>>

Reads the document.

replace(
body: Record<string, unknown>,
): Promise<CosmosItemResponse<Record<string, unknown>>>

Replaces the document wholesale.

patch(operations: readonly CosmosPatchOperation[]): Promise<CosmosItemResponse<Record<string, unknown>>>

Applies a patch to the document server-side.

delete(): Promise<CosmosItemResponse<Record<string, unknown>>>

Deletes the document, throwing a 404 when it does not exist.

Usage

import { type ICosmosItem } from "database-plugin/src/index.ts";