im trying to aggregate various sensors data but until now i've been unsuccessful.
The data schema is this:
{
_id: "613b78bafd96452308232571",
id_machine: "60ec5692a1796250f821222",
time: "2021-09-10T15:24:42.365Z",
value: [
{cod: 'CO2', val: '29'}
{cod: 'Temp', val: '29'}
{cod: 'CO2', val: '29'}
{cod: 'O3', val: '29'}
{cod: 'PM2_5_In', val: '29'}
{cod: 'PM2_5_Out', val: '29'}
{cod: 'PM10_In', val: '29'}
{cod: 'PM10_Out', val: '29'}
{cod: 'Pa1', val: '29'}
{cod: 'Pa2', val: '29'}
{cod: 'UVC', val: '29'}
{cod: 'Hum', val: '29'}
]
}
And what i would like is to have returned the average of each "cod" (avg of CO2, etc) in a given period of time.
Thank you in advanced