Time Series

Build and run time series applications of any scale for any industry. With the optimized and integrated MongoDB application data platform, you get greater ease, speed, and economy than ever before.

Why MongoDB for Time Series


Quickly bring new apps to market with native time series collections which automatically optimize your schema.


Gain faster insights, higher performance and scale with automatic indexing, rich window functions, and compressed storage footprint.

Lower Cost

Eliminate data movement and blend time series with the rest of your enterprise data in a single application data platform.

How Time Series Helps You

db.createCollection("weather", {
  timeseries: {
    timeField: "timestamp",
    metaField: "sensor_id",
    granularity: “hours”
  expireAfterSeconds: 86400

Native Time Series Collections

Quickly get started with a flexible schema optimized for high storage efficiency that helps handle out of order data.

Low Latency Queries

Efficiently scale your queries with automatic clustered indexes on time and secondary indexes on any metadata field.
  "$setWindowFields": {
     "partitionBy": "$game",
     "sortBy": { "score":-1},
     "output": {
        "userRank": {
           "$rank": {}

Real-Time Analytics

Uncover hidden patterns with window functions that let you calculate moving averages and cumulative sums over flexible time windows. Aggregate data across custom time intervals with temporal expressions.

Full Data Lifecycle Management

Natively support the entire time series data lifecycle from ingestion, storage, querying, real-time analysis, and visualization through to online archiving as data ages.

Check out our docs page to learn more!

Frequently Asked Questions

What is Time Series?

Time Series is a sequence of measurements recorded over a period of time. Common data properties include (but not limited to) ordered data, time ingested data and new data that is more valuable than historical data.

How do I store time-series data in MongoDB?

Time series data is straightforward to store in MongoDB. Native-time series collections are optimized for storage efficiency and low latency queries, allowing you to get started with your schema design quickly. To ingest time-series data into your collection, simply insert like you would any other individual document or measurement.

How do I use time-series data?

You can query time-series data in the same way you query other data in MongoDB - using the MongoDB Query API that is available in any popular programming language. With our new clustered indexes, you can query time series at low latency. The MongoDB Query API gives you window functions, allowing you to run analytical queries like time based moving averages and cumulative sums to uncover hidden patterns and new advanced temporal operators, enabling you to write less code and get insights in real-time. You can then use MongoDB Charts to visualize your time series data in real-time.

What are some use cases that use time series data?

Time series data is constantly being generated everywhere and is relevant in every industry. You can find time series data in industries like Energy with IoT sensors collecting power consumption data, water, and temperature measurements to Financial services like loans, stock tickers, or transaction history. Time series data is ubiquitous and found in more places than you think.

How do I combine time series data with other data in my apps?

Time series data sits in a collection right alongside your other enterprise data. You can use the Aggregation Pipeline and MongoDB Query API overall to combine and enrich the two without having to move your data out of specialized time series data stores - one platform, one API, no data movement - making it easy and fast to work with any type of data.

How do I ingest time series data?

You can ingest data directly into time series collections. Optionally, the latest release of the MongoDB Connector for Apache Kafka adds native support for time series. You can automatically create time series collections directly from Kafka topic messages. This enables you to collect data at the edge, process and aggregate it as needed before persisting it into time series collections in MongoDB.

How do I archive old time series data?

You can use our Online Archive - configure a policy, this is coming soon. Also, you can use federated query to combine and work with data across live operational Atlas clusters and cold storage.