New in version 5.0.
Time series collections efficiently store sequences of measurements over a period of time. Time series data is any data that is collected over time and is uniquely identified by one or more rarely-changing parameters. The unchanging parameters that identify your time series data is generally your data source's metadata.
Sensor identifier, location
Stock ticker, exchange
Compared to normal collections, storing time series data in time series collections improves query efficiency and reduces the disk usage for time series data and secondary indexes.
When you insert data, time series collections use an optimized columnar storage format. Compared to normal collections, this storage format provides the following benefits:
- Improved query efficiency
- Increased WiredTiger cache usage
- Decreased input and output
- Reduced disk usage for both data and secondary indexes
Time series collections behave like normal collections. You can insert and query your data as you normally would. MongoDB treats time series collections as writable non-materialized views on internal collections that automatically organize time series data into an optimized storage format on insert.
When you query time series collections, you operate on one document per measurement. Queries on time series collections take advantage of the optimized internal storage format and return results faster.
You must drop time series collections before downgrading:
- MongoDB 6.0 or later to MongoDB 5.0.7 or earlier.
- MongoDB 5.3 to MongoDB 5.0.5 or earlier.
The implementation of time series collections uses internal collections
that reduce disk usage and improve query efficiency. Time series
collections automatically order and index data by time. The internal
index for a time series collection is not displayed by
To improve query performance, you can manually add secondary indexes on measurement fields or any field in your time series collection.
To get started with time series collections, see Create and Query a Time Series Collection.