我用此代码更新了我的 cosmos db 容器
var containerResponse = await _cosmosContainer.ReadContainerAsync();
var containerProperties = containerResponse.Resource;
if (containerProperties.DefaultTimeToLive == null)
{
containerProperties.DefaultTimeToLive = 60 * 60 * 24 * 180; // set 180 days default TTL
await _cosmosContainer.ReplaceContainerAsync(containerProperties);
}
Run Code Online (Sandbox Code Playgroud)
更新 Cosmos DB TTL 容器设置是否会对旧项目产生影响?