Does update Cosmos DB TTL container settings will impact on old items?

Viewed 153

I updated my cosmos db container with this code

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);
            }

Does update Cosmos DB TTL container settings will impact on old items?

1 Answers

From the docs,

After you set the TTL at a container or at an item level, Azure Cosmos DB will automatically remove these items after the time period, since the time they were last modified.

Yes it will impact on old items.

Related