I have the following document :
{
_ids : ...
market : ...
contractorName : ...
field :...
amount : ...
}
and i want to group it first by market then group the result by field (sum of amounts) inside each obtained list as follow :
{
[
market : ...
result : [
{
field : ...
sumOfAmounts : ...
}
]
]
}
any idea how to acheive this using springboot mongotemplate or by using raw mongo