Regrouper par date
db.voltage.aggregate([
{$project: {
date: {$dateToString: {format: "%Y-%m-%d", date: "$EventTS"}},
KeyValues:1
}},
{$unwind: '$KeyValues'},
{$project: {
date: 1,
RVoltage: '$KeyValues.RVoltage'
}},
{$group: {
_id: '$date',
avg: {$avg: '$RVoltage'}
}},
{$sort: {_id: 1}}
])
{ "_id" : "2015-07-02", "avg" : 234.1845454545454 }
{ "_id" : "2016-06-30", "avg" : 249.9316666666667 }
{ "_id" : "2016-07-01", "avg" : 244.08681818181822 }