CosmosDbPartitionedStorage class (original) (raw)

Implements a CosmosDB based storage provider using partitioning for a bot.

Constructors

CosmosDbPartitionedStorage(CosmosDbPartitionedStorageOptions) Initializes a new instance of the class. using the provided CosmosDB credentials, database ID, and container ID.

Methods

delete(string[]) Delete one or more items from the Cosmos DB container.
initialize() Connects to the CosmosDB database and creates / gets the container.
read(string[]) Read one or more items with matching keys from the Cosmos DB container.
write(StoreItems) Insert or update one or more items into the Cosmos DB container.

Constructor Details

CosmosDbPartitionedStorage(CosmosDbPartitionedStorageOptions)

Initializes a new instance of the class. using the provided CosmosDB credentials, database ID, and container ID.

new CosmosDbPartitionedStorage(cosmosDbStorageOptions: CosmosDbPartitionedStorageOptions)

Parameters

Method Details

delete(string[])

Delete one or more items from the Cosmos DB container.

function delete(keys: string[]): Promise<void>

Parameters

keys

string[]

Array of Ids for the items to be deleted.

Returns

Promise

initialize()

Connects to the CosmosDB database and creates / gets the container.

function initialize(): Promise<void>

Returns

Promise

read(string[])

Read one or more items with matching keys from the Cosmos DB container.

function read(keys: string[]): Promise<StoreItems>

Parameters

keys

string[]

A collection of Ids for each item to be retrieved.

Returns

Promise

The read items.

write(StoreItems)

Insert or update one or more items into the Cosmos DB container.

function write(changes: StoreItems): Promise<void>

Parameters

changes

StoreItems

Dictionary of items to be inserted or updated indexed by key.

Returns

Promise