HomeTracks
Explorer···
THEEBUG
Completed0/6
Score0
JSlesson6.js×
THEEBUGlesson6.js
1
const totals = await orders
2
.aggregate([
3
{ $group: { _id: "$userId", total: { ______: "$amount" } } },
4
])
5
.toArray();
$[system] Theebug ready. Happy coding!
Code BlocksDrag blocks into the drop zones above
4 blocks available
$sum
$add
sum
$total
Game Panel
0:000 pts
Level 6 of 6Aggregation Pipeline
0/1 slots correct
Objective
Sum each user's order amounts using the aggregation pipeline's group operator
Expected Output
[{ _id: "ada", total: 150 }]
Debug says:
An aggregation pipeline processes documents through a series of stages — $group here collapses many order documents down into one total per user. Which operator adds up a field across every document in each group?
Debug the Worm