Mongoose populating grouped objects with ref
So I am basically creating simple restaurant manager app where i have menumodel with all schema for the items in the menu, tableModel for tables and orerModel for ordrs.
now in a page i am displaying all the orders in a page and i want to group by item name and table number and display the count of each. Can you please help me achieve this. I am just starting out in MERN so this is all new to me. I have tried $group but its somewhat not right, i have also tried lodash but it gives me the group contents.
and in the ordermodel i have added references to menuModel and tableModel so it becomes a lil difficult or tricky at this point