Hi @Aasawari, thanks for responding to my query. I have solved this issue using `$objectToArray`

operator. For the sake of completion I am adding the issue along with solution that I thought of below. As I am a beginner in mongoDB, I’m not sure if this is an optimal solution, so please feel free to add any other approaches that you might think of :

###
Problem

I am working on a cricket related data. Following is the kind of structure that I have:

```
//overs: [ {over: runs scored in that over}...]
{
innings: 1,
overs: [{"0":5},{"1":9},{"2":8},...,{"19":13}]
}
```

and I wanted to know the total number of runs scored in the 20 overs, like shown below

```
{ innings:1, runs:5+9+8+...+13 }
```

###
Solution

using `$objectToArray`

and `$unwind`

I modified the initial structure to something that looks like this

```
{
{ innings:1, overs:{k:"0",v:5}},
{ innings:1, overs:{k:"1",v:9}},
...
{ innings:1, overs:{k:"19",v:13}},
}
```

then I used `$group`

and `$sum`

operators to get the total runs in an innings.

###
Code

This process can be replicated using the code provided below:

```
db.dummy.insertOne({
"innings":1,
"overs": [
{"0":3}, {"1":4}, {"2":9}, {"3":3}, {"4":9}, {"5":19}, {"6":1}, {"7":11}, {"8":21}, {"9":11},
{"10":3}, {"11":4}, {"12":9}, {"13":3}, {"14":4}, {"15":9}, {"16":11}, {"17":11}, {"18":22}, {"19":1}
]
})
db.dummy.find()
db.dummy.aggregate([
{$unwind: "$overs"},
{$project: {
innings:"$innings",
overs: {$objectToArray: "$overs"}
}},
{$unwind:"$overs"},
{$group: {
_id: {innings:"$innings"},
runs: {
$sum: "$overs.v"
}
}}
])
```