Hey @deep_jagani,
Thanks for reaching out to the MongoDB Community forums
When designing a TimeSeries schema, your choices should be guided by how you intend to retrieve and work with your data, as well as how frequently data ingestion occurs.
If you prefer straightforward and easy queries, creating a single TimeSeries collection with a document for each timestamp at seconds granularity, containing the IoT device name as metadata followed by its value, is a good option. This approach simplifies your queries, avoiding unnecessary complexity and processing.
The MongoDB 6.3 and later automatically creates a compound index on the time and metadata fields for new time series collections. Consequently, if there’s a need to improve the sort perfromance you can create secondary indexes.
Starting with MongoDB 5.0, the default durability guarantee has been elevated to the majority (w:majority
) write concern. This means that write success will now only be acknowledged to the application once it has been committed and persisted to disk on a majority of replicas. To read more, please refer to the https://www.mongodb.com/blog/post/default-majority-write-concern-providing-stronger-durability-guarantees-out-box
Also, you can refer to the following resources to learn more about the Time Series data:
- Time Series Data and MongoDB: Best Practices Guide [White Paper]
- Best Practices for Time Series Collections documentation
- Time Series Collection Limitations
- Time Series Compression
Best regards,
Kushagra