CosmosDbPartitionedStorage class
Implements a CosmosDB based storage provider using partitioning for a bot.
Constructors
| Cosmos |
Initializes a new instance of the <see cref="CosmosDbPartitionedStorage"/> 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(Store |
Insert or update one or more items into the Cosmos DB container. |
Constructor Details
CosmosDbPartitionedStorage(CosmosDbPartitionedStorageOptions)
Initializes a new instance of the <see cref="CosmosDbPartitionedStorage"/> class. using the provided CosmosDB credentials, database ID, and container ID.
new CosmosDbPartitionedStorage(cosmosDbStorageOptions: CosmosDbPartitionedStorageOptions)
Parameters
- cosmosDbStorageOptions
- CosmosDbPartitionedStorageOptions
Cosmos DB partitioned storage configuration options.
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<void>
initialize()
Connects to the CosmosDB database and creates / gets the container.
function initialize(): Promise<void>
Returns
Promise<void>
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<StoreItems>
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<void>