Skip to content

[Rule] Use TTL (Time-to-Live) for automatic data expiration #166

Description

@sajeetharan

Cosmos DB supports TTL at both container and item level, allowing automatic deletion of expired data without consuming RUs. Many developers write scheduled cleanup jobs instead of using this built-in feature.

We need a rule that advises:

  • Enable TTL on the container (set default or per-item)
  • Use -1\ (no expiry) as default with per-item overrides for flexible retention
  • Common patterns: session tokens, event logs, temporary caches

Category: \model-\ Data Modeling
Impact: Medium
Suggested file: \skills/cosmosdb-best-practices/rules/model-ttl-expiration.md\

References:


This is a good first issue! Follow the Contributing Guide and use the rule template to get started.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions