Azure / azure-cosmos-python

🚨🚨🚨This SDK is now maintained at https://github.com/Azure/azure-sdk-for-python 🚨🚨🚨
https://github.com/Azure/azure-sdk-for-python
MIT License
150 stars 141 forks source link

Possible to change collection ttl after creation? #114

Closed ElvaHuang closed 6 years ago

ElvaHuang commented 6 years ago

My application relies heavily on pydocumentdb to interact with cosmos. We're looking for the ability to change TTL of a collection after its creation. We already know how to query the collection offer and change throughput by placing in an replacement offer. But I don't see a field for TTL there.

Is this supported? If not, what's a reasonable workaround?

Thank you!

srinathnarayanan commented 6 years ago

Hi @ElvaHuang You can replace the collection definition to modify its TTL value:
coll = client.ReadCollection(COLLECTION_LINK) coll['defaultTtl'] = NEW_TTL_VALUE client.ReplaceCollection(COLLECTION_LINK, coll)