We’re exploring MongoDB time-series collections to export/stream, and aggregate resource metrics like CPU, Memory, etc., at various time intervals as emitted by the source
Each document you insert should contain a single measurement
So, I have a few questions now
should each document carry data of only one measurement? Or can we combine multiple measurements in one document?
The example mentioned in the documentation referenced refers to “Temperature” as the measurement stored inside a collection called “weather”. Does this mean we should use a dedicated collection for every measurement? In our case, should we have a separate collection for each of the metrics like CPU, Memory, Disk etc.?
Can we combine all the measurements into one document for a given timestamp? I guess this would avoid ending up having multiple collections and/or documents for every measurement we need to manage
E.g. we create a single collection named metrics supposed to contain all the different metric measurements at given time intervals
Then, we insert a document which consists of the metaField metadata indicating what kind of measurement we’re inserting and then the actual measurement as another object like below
thank you very much, @Emmanuel_Bernard1! that is very helpful! so, this means we could put as many measurements or metrics as we need and not restricted to just one metric per document in a time-series collection
a few questions
can we embed these measurements under an object like "metrics":{"cpu":50,"mem":60,"disk":35} instead of having those metric fields directly in the root of the document?
similarly, can the metaField be an object instead of a single value?