Company
Date Published
Author
MongoDB
Word count
1969
Language
English
Hacker News points
None

Summary

This schema design for time series data in MongoDB takes advantage of the document-oriented model, allowing for efficient storage and retrieval of large amounts of ordered data. By storing multiple readings in a single document, one document per minute, and using sub-documents to isolate repeating data structures, this approach improves performance for reads and reduces storage efficiency. The use of field-level updates and the $inc operator enables more efficient writes, reducing disk I/O and network traffic. This design also allows for faster reads, with the ability to access an hour's worth of data in a single read. The document model is flexible enough to accommodate various time series data use cases, including analyzing historical data to predict future trends or establishing operational thresholds. The MongoDB Management Service (MMS) implementation takes this approach further by maintaining copies at varying degrees of granularity and tracking additional metadata for display options such as "avg/sec". Overall, this schema design provides a scalable and efficient way to store and analyze time series data in MongoDB.