Does Azure Cosmos DB support setting a TTL
for a Table? How can we set that from code while creating the table with CreateIfNotExists
call? (I am using Microsoft.Azure.Cosmos.Table
) I am not looking for setting it per-item basis (I found in feature requests that it is not available as a feature yet) and want it to be applicable on all entries in the table.
Asked
Active
Viewed 1,567 times
0

Sayantan Ghosh
- 998
- 2
- 9
- 29
-
Does this [link](https://stackoverflow.com/questions/62550860/is-there-a-way-to-programmatically-change-ttl-on-a-cosmos-db-table) answer your question? – Steve Johnson Jul 13 '20 at 01:05
1 Answers
0
It is available in the DOCS
// Create a new container with TTL enabled and a 90 day expiration
DocumentCollection collectionDefinition = new DocumentCollection();
collectionDefinition.Id = "myContainer";
collectionDefinition.PartitionKey.Paths.Add("/myPartitionKey");
collectionDefinition.DefaultTimeToLive = 90 * 60 * 60 * 24 // expire all documents after 90 days

Sajeetharan
- 216,225
- 63
- 350
- 396
-
I am looking for table APIs (using Microsoft.Azure.Cosmos.Table), could you please point to Table creation calls for it? – Sayantan Ghosh Jul 11 '20 at 20:54