From 96136c8e85b2b69241ab3455008c81f059dd4e6e Mon Sep 17 00:00:00 2001 From: papicc45 Date: Wed, 6 Dec 2023 11:48:00 +0900 Subject: [PATCH] fix : top5 group by categoryName --- controller/CategoryController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/CategoryController.js b/controller/CategoryController.js index 77b32a0..f23ab03 100644 --- a/controller/CategoryController.js +++ b/controller/CategoryController.js @@ -38,7 +38,7 @@ exports.getTop5 = async (req, res)=> { $match: { temperature: { $gte: temp_min, $lte: temp_max } } }, { - $group: { categoryName : "$categoryName", count: { $sum: "$count" } } + $group: { _id: "$categoryName", count: { $sum: "$count" } } }, { $sort: { count: -1 }