azure - 以编程方式验证是否在 Cosmos DB 集合上启用了 TTL

标签 azure azure-cosmosdb azure-cosmosdb-sqlapi

当前是否可以使用 cosmos sql api 和 c# 以编程方式验证是否在某些集合上启用了 TTL,如果没有则启用它?

最佳答案

是的,下面的代码应该有帮助。

CosmosClient client = new CosmosClient(connection, options );              

Container container = await GetContainer(client, "database1", "container1");
ContainerProperties containerProperties = await container.ReadContainerAsync();

int? ttl = containerProperties.DefaultTimeToLive;

关于azure - 以编程方式验证是否在 Cosmos DB 集合上启用了 TTL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65943093/

相关文章:

database - 单个嵌入文档中的 Cosmos DB SQL 查询

azure - 使用 Azure Cosmos DB 的 Bicep 模板创建多个角色定义和分配

azure - VSO 构建管道的 Nuget 恢复失败

azure - 无法将 Azure 容器注册表与 Azure Function App 链接

node.js - Azure Pipeline降级NPM版本

Azure服务总线队列: re-schedule messages while increasing deliveryCount

c# - 为什么 CosmosDB 只保存公共(public)成员?

azure - 如何查询 cosmosdb/sql,其中两个属性随时间变化

c# - 无法为接口(interface)模拟传递构造函数参数(Mock IFeedResponse)

excel - 如何将 MS Excel 连接到 Azure Cosmos DB-SQLAPI?