I have the following collection:
[
{
"_id": "54efdd4a70726f7af1030000",
"sequence_name": "Do Stuff",
"calendar": [
"2015-02-28T09:00:00.000Z",
"2015-02-28T18:00:00.000Z",
"2015-03-01T03:00:00.000Z"
]
}
]
I need to group it like this:
{
"2015-02-28T09:00:00.000Z": [
{
"_id": "54efdd4a70726f7af1030000",
"sequence_name": "Do Stuff",
}
],
"2015-02-28T18:00:00.000Z": [
{
"_id": "54efdd4a70726f7af1030000",
"sequence_name": "Do Stuff"
}
]
// key/values keep going for each ...
}
So that I could (hopefully) display the data like this:
<div ng-repeat='(date, scheds) in prettyDates'>
<h6>{{ date | date: 'd MMM' }}</h6>
<div>{{ date | date: 'hh:mma' }}</div>
<div ng-repeat='s in scheds'>
<div class='event-time'>{{ s.start_time | date: 'h a' }}</div>
<div class='event-title'>{{ s.sequence_name }}</div>
</div>
</div>
Does angular have a way of doing a groupBy when there are multiple items to group by or when groups will have duplicate entries?