the below code gives the list of attendance whose WorkStatus is “P”, it takes last $and value($and: {$eq: [“$$attendance.WorkStatus”, “P”],},) from $filter, but i want to get count of each WorkStatus separately(i.e. “MIS”,”A”,”P”).
{$facet: {totalCount: [{ $count: “sum” }],aggregatedData: [{$project: {date: “$date”,
attendance: { $filter: { input: “$attendance”,as: “attendance”,cond: {$and: { $eq [“$$attendance.WorkStatus”, “MIS”], }, $and: {$eq: [“$$attendance.WorkStatus”, “A”],},$and: { $eq: [“$$item.WorkStatus”, “P”]