MongoDB aggregation exercise.
Ready — edit the code above and click Run.
db.products.aggregate([{ $group: { _id: "$category", avg: { $avg: "$price" } } }]);
Try solving on your own first, then reveal the official answer.
MongoDB shell syntax for interviews.