hi guy’s i need some help for deadline task.
this is sample of my document and query 
my query always give 0 result
the question is how to get a final score from sum average
i wish the result become like this
[
{
"_id": "NILAI HARIAN",
"average": 77.85714285714286,
"many": 7,
"sum": 545
},
{
"_id": "PENILAIAAN TENGAH SEMESTER",
"average": 80,
"many": 1,
"sum": 80
},
{
"_id": "PENILAIAAN AKHIR SEMESTER",
"average": 73,
"many": 1,
"sum": 73,
"final_score": 0,
}
]
steevej
(Steeve Juneau)
2
A field that is created in a stage is only available in the next stage. In your $group, the field average: cannot be used to compute final_score:.
average: {
$avg: "$datas.report.scores.value",
},
final_score: {
$sum: "$average"
}
and how to make return became like this
[
{
"_id": "PENILAIAAN AKHIR SEMESTER",
"average": 73,
"many": 1,
"sum": 73
},
{
"_id": "NILAI HARIAN",
"average": 77.85714285714286,
"many": 7,
"sum": 545
},
{
"_id": "PENILAIAAN TENGAH SEMESTER",
"average": 80,
"many": 1,
"sum": 80
},
"final_score":230
]
final score got from sum of average ?
steevej
(Steeve Juneau)
4
Share what you have tried and explained how it failed to provide the desired result.
This would help us save time by not investigation in a direction that you already know does not work.