Start a new topic

What's the best practice for fetching entries grouped by date?

I have a collection of notices and I'd like them grouped by date. I could do this on the client side by creating the object structure I need from a query, or I could use collection access to return a JSON object in the structure that I want. The collection access seems like the smarter solution; I'm just not sure how to go about implementing it.



Here is roughly the structure I'd like:



[{"posted_on" : "some date",

"entries" :[{ "title" : "A Title"},{"title" : "A Title"}]

},

{"posted_on" : "some date",

"entries" :[{ "title" : "A Title"},{"title" : "A Title"}]

}]



Any help would be appreciated.



— Bill

Hi Bill,



What's your data model look like currently? What library are you using to develop your app in? We have some grouping functions that would potentially return what you are looking for within the libraries themselves.
Assuming we don't use the Kinvey entity dates, I'm guessing there isn't any automatic way to handle date filtering/grouping with queries - as the date would really just be stored as a string in whatever format you submit. If that's true, maybe a Kinvey dev can confirm if our best solution be to implement a collection hook or maybe use the matches operator with a regex set up for our specific date format?
Login or Signup to post a comment