Azure Cosmos DB文档TTL设为-1时,变更源数据保留时长咨询
Azure Cosmos DB: Change Feed Retention When Document TTL is Set to -1
Hey there! Let's break down this common point of confusion between TTL and Change Feed behavior clearly:
First, a quick recap: Setting a document's TTL to -1 means that document will never automatically expire or be deleted by the Cosmos DB TTL mechanism — it'll stick around until you manually remove it.
Now, for the Change Feed part:
- The Change Feed's data retention is a container-level setting, not tied to individual document TTL values. By default, Cosmos DB keeps Change Feed data for 7 days, regardless of whether your documents have TTL set to
-1, a positive number, or no TTL at all. - If you need longer retention, you can configure the Change Feed retention period when creating your container (or update it later if needed) to a maximum of 365 days. This controls how long all change records (creates, updates, deletes) stay in the feed.
- One key note: Even if a document has TTL=-1, any changes to that document (like updates or manual deletions) will be retained in the Change Feed for the full duration of your container's configured retention period. If you never delete the document manually, its creation/update records will stay until the Change Feed's retention window closes.
内容的提问来源于stack exchange,提问作者zile
相关产品推荐
相关产品推荐

