简体   繁体   中英

Set time limit for items in container in CosmosDB using Microsoft.Bot.Builder.Azure (bot framework v4)

I want to set the time to live for the items in a container in cosmosDB, but I am not sure how to do so using the config of cosmosdb storage in bot framework v4. I would appreciate some help on this matter.

I have read about setting time to live using DocumentClient() as documented here . However I set up my storage like this:

var storage = new CosmosDbStorage(new CosmosDbStorageOptions
        {
            AuthKey = CosmosDBKey,
            CollectionId = CosmosDBCollectionName,
            CosmosDBEndpoint = new Uri(CosmosServiceEndpoint),
            DatabaseId = CosmosDBDatabaseName,
        });

How can I set time to live with this config of my cosmosDB storage?

BotBuilder SDK doesn't currently allow you to create a Collection with DefaultTimeToLive .

However, you can do so in the Azure Portal once your Collection has been created and then set it:

  1. Open the Azure Portal
  2. Go to your Resource Group
  3. Open your CosmosDB Service
  4. On the left, go to Data Explorer
  5. Expand your Database
  6. Expand your Collection
  7. Click Scale & Settings
  8. Adjust Settings > Time to Live

    在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM