TTL on timestamp fields are not accepted on older instances of Azure Cosmo DB for MongoDB

Kris Lemoine 25 Reputation points
2024-07-22T12:40:00.61+00:00

We are using several Azure Cosmos DB for MongoDB (RU) instances running on server version 4.2.

We now want to create a TTL index on a timestamp field. When we create the index it gives the exception "The 'expireAfterSeconds' option is supported on '_ts' field only." We tried with updating the server to version 6.0, but still the same exception.

When we create a new instance, even in version 4.2, we are able to create the TTL index.

Our older instances don't allow the index on a timestamp field. Is there a way to update or enable this feature?

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

Accepted answer
  1. Jens Neubauer 80 Reputation points
    2024-08-08T11:54:25.42+00:00

    I think I found the reason.

    This page mentions the capability "EnableTtlOnCustomPath", but also states "This capability cannot be enabled on an Azure Cosmos DB for MongoDB accounts with continuous backup."

    And of course continous backup cannot be disabled once it is enabled.

    Edited to add: I was able to set the capability using Azure CLI and (after a while) was able to create a TTL index, even though the documentation says I shouldn't be able to...

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

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.