Hello Everyone,
I am using the below query to group data by resource but I want all data in that particular resource how can I do that
`var m = await model.aggregate([{$group : {_id: {resource : '$resource', project: '$project', reporting_to: '$reporting_to', remark: '$remark', occupancy: '$occupancy', status: '$status'}, count: { $sum: 1 }}}]);`
what I want is to group it by the resource : '$resource'
and get all the items in that particular resource entry, in case with my above query its is showing all 6 entries but i dont want duplicated entry if there are two resource of same name so it should give me the latest one
Thank you in Advance
Juned Adenwalla,