Hello...
I realized that there is no/limited support for aggregation on nested objects but I am hoping that there is a workaround for my problem.
My JSON document looks like
id 1
"aps": {
"mac": "36",
"radio": [
{
"slot": 0,
"count": 10
},
{
"slot": 1,
"count": 100
}
]
}
id 2
"aps": {
"mac": "36",
"radio": [
{
"slot": 0,
"count": 30
},
{
"slot": 1,
"count": 300
}
]
}
I would like to perform an aggregation on these documents. For example,
compute the average value of count but split it based on slot.
So with the above I would get two values
avg_slot_0 = 20
avg_slot_1 = 200
Is there a way to do this?
I do realize that I can make this work by splitting each document and storing it based on each radio but for various reasons I cannot do that.
I am hoping to make it work without splitting.
Thanks in advance.