Reputation: 429
My main concern is about the documents that grow a lot over time (inserting to embedded array of measurements) and the general document structure that makes the measurements hard to query for a given date/time range.
E.g. Even if there was only one node reporting data each 5 seconds, then the total number of measurements in embedded array (only for one day) is: 24*60*60/5=17280. Having 5 nodes reporting for a month gives: 5 embedded arrays with 518400 elements (in one document!). The longer the device works, the more entries it has in embedded array of measurements for each node attached.
Is it justified in this case to sacrifice all the good things of embedding and split the data into 2 collections?
What I have been thinking of is e.g. one collection for device/node configuration (embedding information here since there isn't much of it), and the second only for measurements (with references to the device and node it came from). I think that this will cost a few calls to the DB more, but will be better in terms of performance and memory usage.
Upvotes: 2
Views: 333
Reputation: 18625
In order :
Upvotes: 2