ttl field on Azure Cosmos DB NOSQL API doesn't appear in documents

David Pereira 1 Reputation point
2022-12-20T13:18:37.473+00:00

Hello,

I have a NOSQL API cosmos DB and I'm trying to use the TTL feature.
However I can't get the ttl field to appear on my documents for my container that has TTL ON.

I have two Azure subscriptions, in one of them I create a NOSQL API cosmos DB and documents appear with the "ttl" field, basically the feature works just fine.
On the other subscription it doesn't work, even when the cosmos DB has the same setup, TTL only works on the container level. If I set the "ttl" field on the document, it doesn't even appear when I try to view it with Data Explorer, but the rest of the document's fields are fine.

What are the reasons the TTL feature could work on some cosmos DB accounts and others don't?
Any idea how I can troubleshoot this?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,903 questions
{count} votes

1 answer

Sort by: Most helpful
  1. David Pereira 1 Reputation point
    2022-12-22T16:25:49.85+00:00

    Hi Geetha, it appears the problem is resolved without any changes to configuration. Perhaps it had something to do with indexes or "caching", something that prevented the ttl field to appear on the documents the first time. It was an existing container with tons of documents, perhaps changing the settings to TTL ON, updating and then creating documents with the "ttl" field takes some time on cosmos DB to apply.

    Nevertheless it's resolved, thanks!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.