hi Zalim,
you're following the right documentation, but hitting an internal server error when trying to enable analytical storage ttl. this usually points to a backend issue or a specific limitation with your existing collection.
let's double check the prerequisites. analytical storage for cosmos db for mongodb requires the account to be using mongoDB version 3.6 or higher. please verify your account's server version in the azure portal.
another common pitfall is the collection's sharding key. for analytical storage to work, the collection must be sharded. if it's an unsharded collection, the operation might fail. you can check this in the data explorer. if both of those are correct, the internal error might be due to the collection's current state or size. sometimes, there's a temporary provisioning issue.
as a workaround, try creating a new collection with the analytical storage ttl enabled from the start. use the az cosmosdb mongodb collection create command with the --analytical-storage-ttl parameter set. if this works, you could then migrate your data from the old collection to the new one.
if the new collection also fails, this strongly suggests a platform side issue or a regional limitation. your best course of action is to contact azure support. they can check the backend logs for your specific account and collection to see the exact cause of the internal server error.
verify your mongoDB version and that the collection is sharded. if all looks good, try creating a new collection with analytical ttl enabled. if that also fails, contact support.
regards,
Alex
and "yes" if you would follow me at Q&A - personaly thx.
P.S. If my answer help to you, please Accept my answer