For example, Documents.
[
{
"username": "joy",
"size_info": [
{
"size": "M",
"width": 100,
"height": 102
},
{
"size": "M",
"width": 102,
"height": 104
},
{
"size": "S",
"width": 80,
"height": 82
}
]
}
]
I want to group size_info.size and push the array with the width and height.
I am trying to create an aggregation query. For example for the given documents above, it would look like below:
[
{
"username": "joy",
"size_info": [
{
"size": "M",
"actual_size": [
{
"width": 100,
"height": 102
},
{
"width": 102,
"height": 104
}
]
},
{
"size": "S",
"actual_size": [
{
"width": 80,
"height": 82
}
]
}
]
}
]
Is it possible? Thank you for helping.