Built for Measurements
A time series collection is a special collection type optimized for data points that arrive with a timestamp, such as sensor readings, prices, or metrics. It stores this data far more compactly than a normal collection.
How It Optimizes
You declare a time field, an optional meta field that identifies the source, and a granularity hint.
- Documents from the same source over a window are grouped into compact buckets internally.
- Bucketing slashes storage and makes range scans over time efficient.
- The meta field groups a series, like a device id, so queries for one source touch fewer buckets.
Behavior and Limits
- Inserts are append oriented and the layout favors recent time ranges.
- You query a time series collection like any other, and the engine unpacks buckets transparently.
- An optional automatic expiry can delete data older than a chosen age, useful for rolling windows.
Choosing a granularity that matches your insert interval keeps buckets well sized and queries fast.
Key idea
Time series collections bucket timestamped measurements by source and time to cut storage and speed range queries, with an optional expiry for rolling retention windows.