Docs Menu

Docs HomeMongoDB Compass

Create a Time Series Collection

On this page

  • Procedure
  • Restrictions and Limitations

Time series collections efficiently store sequences of measurements over a period of time.

1

From the Collections screen, click the Create Collection button.

2
3

Check the Time Series Collection option.

4

Specify which field should be used as the timeField for the time-series collection. This field must have a BSON type date.

The following fields are optional:

Field
Description
metaField
The name of the field which contains metadata in each time series document. The metadata in the specified field should be data that is used to label a unique series of documents.
granularity

The granularity field allows specifying a coarser granularity so measurements over a longer time span can be more efficiently stored and queried.

The default value is set to seconds.

expireAfterSeconds
The expireAfterSeconds field enables automatic deletion of documents older than the specified number of seconds.

For more information on time series fields, see Time Series Collections.

5

Your collection will be marked by a time series badge. On the left-hand navigation bar your time series collection will have the following icon:

Time Series Icon

The following restrictions and limitations apply when creating a time series collection:

  • Custom collation is the only Advanced Collection Option that can be used alongside your time series collation.

  • See Time Series Collection Limitations for all time series collection limitations.

←  Create a Collection with Queryable EncryptionViews →