From 84bec439cda296a968bac6818e851568a9bea0d3 Mon Sep 17 00:00:00 2001 From: HarshN187 Date: Fri, 24 Nov 2023 21:43:35 +0530 Subject: [PATCH] monthWiseEnroll changes done !! --- Controller/UtilizationController.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Controller/UtilizationController.js b/Controller/UtilizationController.js index a3cee74..b3b9c71 100644 --- a/Controller/UtilizationController.js +++ b/Controller/UtilizationController.js @@ -281,10 +281,21 @@ module.exports.monthWiseEnroll = async function (req, res) { }, ] : []), + ...(req.query.sports + ? [ + { + $match: { + sports: new mongoose.Types.ObjectId( + req.query.sports + ), + }, + }, + ] + : []), { $group: { _id: { - // "$sports", + // sports: "$sports", month: { $month: "$from" }, year: { $year: "$from" }, }, @@ -301,6 +312,7 @@ module.exports.monthWiseEnroll = async function (req, res) { // console.log(result); res.json({ + datas:result.length, data: result, rcode: 200, });