Timeseries collection

Hello @Prasanna_Sasne ,

A time-series collection in MongoDB is a special type of collection that is optimized for storing time-series data. Time-series data is typically data that is captured over time and has a timestamp associated with each data point. Examples include sensor data, log data, and financial market data.

Looking at the use case you shared, I think the time-series collection would be a good fit for storing sensor data at different temperatures, with a timestamp associated with each data point. You can create a single TS collection to hold all the sensor data with metadata fields, such as sensor name and city, as document fields.

It is not necessary to do so as you can store all the data in a single collection. Internally, the data is stored in a bucket format based on its metadata and timestamp. By default, each bucket can store up to 1000 documents. As you add data from different sensors, internally the bucket will be created for each sensor based on its metadata and timestamp.

Please refer to the linked post to understand the bucketing pattern in MongoDB’s Time-Series collections.

It is common practice to include metadata fields, such as sensor name and city, as fields within each document when storing data. I hope this addresses your query, but please let me know if you require any additional clarification.

The maximum BSON document size is 16 megabytes and it’s still applicable. Can you please clarify what you meant by splitting data here?

For more information, you can refer to the below resources

Regards,
Tarun

2 Likes