<!-- llms-explorer concept facts · https://llms-explorer.com/tree/time-series-aggregation/ · pack 2026-10-15 · ~2263 tokens -->

# Time Series Aggregation

> Depth-first rabbithole dossier for Time Series Aggregation; source-anchored research pack.

Parent: [MongoDB Aggregation Pipeline](https://llms-explorer.com/tree/mongodb-aggregation-pipeline/) · 7 facets · 22 facts · page: https://llms-explorer.com/tree/time-series-aggregation/

## Definitions

- [low] The map-reduce framework in MongoDB is a predecessor to the aggregation framework and is more complex to use. Sources: https://studio3t.com/knowledge-base/articles/mongodb-aggregation-framework/ — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`

## Structure and components

- [low] If a time series collection contains `timeField` timestamps before 1970-01-01T00:00:00.000Z or after 2038-01-19T03:14:07.000Z, an index on the `timeField` must be created to optimize queries. Sources: https://www.mongodb.com/docs/manual/core/timeseries/timeseries-limitations.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`

## How it works

- [low] Because the internal index for a time series collection lacks an index for the `_id` key, searching documents based on `_id` requires a COLLSCAN operation by default. Sources: https://blog.allegro.tech/2021/12/performance-evaluation-of-timeseries.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#antipatterns`

## Measurements and reference values

- [low] The maximum size for documents within a time series collection is 4 MB. Sources: https://www.mongodb.com/docs/manual/core/timeseries/timeseries-limitations.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`
- [low] For any granularity configuration, the maximum size of a bucket in a time series collection is 1000 measurements or 125KB of data, whichever is lower. Sources: https://www.mongodb.com/docs/manual/core/timeseries/timeseries-limitations.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`

## Problems, failure modes and limitations

- [low] The `$merge` aggregation stage cannot be used to add data from another collection to a time series collection, although it can be used to move data from a time series collection to another collection. Sources: https://www.mongodb.com/docs/manual/core/timeseries/timeseries-limitations.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`
- [low] MongoDB automatically enables block processing for eligible time series queries, and users cannot manually specify whether a query uses this feature. Sources: https://www.mongodb.com/docs/manual/core/timeseries/timeseries-querying.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`
- [low] The `query` field cannot be used for the `$geoNear` stage on a time series collection, but the `key` field must be specified. Sources: https://www.mongodb.com/docs/manual/core/timeseries/timeseries-limitations.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`
- [low] Documents in a time series collection are immutable once saved, meaning they cannot be updated or deleted. Sources: https://blog.allegro.tech/2021/12/performance-evaluation-of-timeseries.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#antipatterns`
- [low] Aggregation can leverage an index for `{deviceID: 1, timestamp: 1}` to avoid slow in-memory sort operations in the `$setWindowFields` stage. Sources: https://www.practical-mongodb-aggregations.com/examples/time-series/state-change-boundaries.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#methodology`

## Comparisons and alternatives

- [low] In MongoDB, time series are materialized views that cover physical collections rather than actual collections. Sources: https://blog.allegro.tech/2021/12/performance-evaluation-of-timeseries.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`
- [low] Filling a time series collection was faster at 3:30,11 compared to 4:39,48 for a standard collection. (verified as of 2026-10-15) Sources: https://blog.allegro.tech/2021/12/performance-evaluation-of-timeseries.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#methodology`

## Facts and statements

- [low] Starting in version 8.0, MongoDB may execute certain time series queries using block processing, which significantly improves performance and reduces overhead for long running aggregation pipelines that begin with $match, $sort (if used on the timeField), or $group; the improvement varies with workload and instance configuration. (verified as of 2026-10-15) Sources: https://www.mongodb.com/docs/manual/core/timeseries/timeseries-querying.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`
- [low] The `$out` aggregation stage is used to write documents to a time series collection. Sources: https://www.mongodb.com/docs/manual/core/timeseries/timeseries-limitations.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`
- [low] To group documents by distinct values in a time series collection, use the `$group` aggregation stage. Sources: https://www.mongodb.com/docs/manual/core/timeseries/timeseries-limitations.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`
- [low] Recent transactions in time series collections are kept in memory to facilitate real-time data streaming. Sources: https://www.mongodb.com/docs/manual/core/timeseries/timeseries-querying.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`
- [low] The minimum MongoDB version required is 5.0 due to the use of time series collections, the `$setWindowFields` stage, and the `$shift` operator. (verified as of 2026-10-15) Sources: https://www.practical-mongodb-aggregations.com/examples/time-series/state-change-boundaries.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#core`
- [low] A time series collection can be created using the command `db.createCollection("coll-ts", { timeseries: { timeField: "timestamp" } } )`. Sources: https://blog.allegro.tech/2021/12/performance-evaluation-of-timeseries.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#tools`
- [low] Time series collections can be used to store sequences of device measurements over time for efficient storage and fast querying. Sources: https://www.practical-mongodb-aggregations.com/examples/time-series/state-change-boundaries.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#methodology`
- [low] The only way to delete data in a time series collection is to use the `drop()` command or define retention using the `expireAfterSeconds` parameter. Sources: https://blog.allegro.tech/2021/12/performance-evaluation-of-timeseries.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#patterns`
- [low] A time series collection for device status can be created with `db.createCollection("device_status", { "timeseries": { "timeField": "timestamp", "metaField": "deviceID", "granularity": "minutes" } });`. Sources: https://www.practical-mongodb-aggregations.com/examples/time-series/state-change-boundaries.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#patterns`
- [low] The internal index for a time series collection does not have a sorting feature and is not displayed. Sources: https://blog.allegro.tech/2021/12/performance-evaluation-of-timeseries.html — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/time-series-aggregation-96a5da320f/rabbithole-synthesis.md#antipatterns`

## Related concepts

- Time — is a part of Time Series Aggregation
- Series — is a part of Time Series Aggregation
- Aggregation — is a part of Time Series Aggregation
