System Information
- Strapi Version: 4.1.9
- Operating System: Endevour OS (Arch Linux)
- Database: default in dev env
- Node Version: 14.19.1
- NPM Version: 6.14.16
- Yarn Version: 1.22.18
Hi,
I have two collections, let’s say collection A and collection B. They have a one to many relation: A items can have many B items.
I can make a call to the api for getting items in A populated with related items in B by calling:
http://localhost:1337/api/a?populate[b][populate]=*
that works great. I would like to get only one item from B ordering by a date field, this is, instead of getting all B items related to the A item, get only one sorted by a date field.
I’ve tried sorting, like this:
http://localhost:1337/api/a?populate[b][sort][0]=startDate:desc
and works great, but I would like to add a limit for getting only one item.
Any idea about doing this through the generated endpoint or do I have to make a custom endpoint for this?
Thanks!