Group simple Meteor Collection by field -
this question has been asked in different forms before have never found simple concise answer.
i have basic collection use in template:
template.snackpage.helpers({ snacks: function() { return snacks.find({}, {sort: {day: 1}}); } }); which returns this:
{ {day: "04-05-2016", title: "oranges"}, {day: "04-05-2016", title: "bananas"}, {day: "07-05-2016", title: "grapes"}, {day: "07-05-2016", title: "herrings"}, {day: "09-05-2016", title: "mint slices"}, } i want list in template day heading this:
day: 04-05-2016 - oranges - bananas day: 07-05-2016 - grapes - herrings day: 09-05-2016 - mint slices my question how do while maintaining reactivity , least overhead/fuss :)
underscores _.groupby might work this. using mongo aggregation pipleline: http://docs.mongodb.org/manual/core/aggregation-pipeline/
heres similar question: "group by" queries on meteor collection
Comments
Post a Comment