Hello,
While building my first Meteor app I found something I don’t even know how to approach.
I have a list of Entries in a collection and I want to categorise them by date (not to sort them by date). Each entry has a date and I want to build something like a timeline. Here’s how one of those entries looks like:
{
"_id": "xHmfEc5gMmGzDZgD2",
"title": "sth",
"labels": [
"pv4LnWNheyYRJqG7D"
],
"images": [
"zitE3FwmesHsNCxGG",
"kYQTJYApDxPr4sMdW",
"4enopyawfqBXRDvuh"
],
"author": "TMviRL8otm3ZsddSt",
"createdAt": "2016-01-31T21:05:55.401Z",
"date": "2016-01-31T21:05:55.401Z",
"description": "desc"
}
In the end I want to achieve something like a timeline and I want the entries to belong to a day. Here’s how that might look like:
Day - 11.02.2016
entry - xHmfEc5gMmGzDZgD2
entry - ZhmfEc5gMmGzDZg8z
entry - uafEc5gMmGzDZgD25
Day - 12.02.2016
entry - xHmfEc5gMmGzDZgD2
entry - ZhmfEc5gMmGzDZg8z
Day - 17.02.2016
entry - xHmfEc5gMmGzDZgD2
entry - ZhmfEc5gMmGzDZg8z
entry - xHmfEc5gMmGzDZgD2
entry - ZhmfEc5gMmGzDZg8z
But I want to get the days out of the entries, not to Create a separate collection for a calendar. If it’s possible…
What would be a good way to achieve this ?
The only way I can imagine to do this at the moment is to store all the different dates from the entries into a separate collection and then, each day should query the entries collection to get the ones that fit. But I think this is a really bad way to do it as for each day I will have a DB query…