documentation icon indicating copy to clipboard operation
documentation copied to clipboard

[Bug]: The population and pagination operators cannot be combined.

Open Boegie19 opened this issue 2 years ago • 4 comments

Link to the documentation page or resource

https://docs.strapi.io/dev-docs/api/rest/populate-select#combining-population-with-other-operators

Describe the bug

I am 99% sure that you can limit and use offset while populating so saying that you can not is strange + it will cause people to not limit there stuff with populates (this is only on the top level or the request the docs make it sound like it is not possible at all)

Additional context

No response

Suggested improvements or fixes

remove it or clarify its meaning

Related issue(s)/PR(s)

https://forum.strapi.io/t/advanced-api-filter-combining-and-and-or/24375/10

Boegie19 avatar Mar 09 '23 17:03 Boegie19

The documentation is not clear about this issue, i.e "pagination on population". If this feature does not exist, it is better to explain the reason transparently. Or if it exists and, for example, it is not recommended to do this from a performance perspective, it should be explained.

Currently, pagination on population with the ‍‍limit and start keys works in version v4.9 (although no information about the total number of paginated items is provided in the output). For example, the following API correctly retrieves the first post and returns only the second five comments for this post.

Strapi Version: v4.9.2
Get: /api/posts?fields=title&populate[comments][limit]=5&populate[comments][start]=5
Result: It works correctly.

However, using ‍pageSize and page in this case does not work. i.e:

Strapi Version: v4.9.2
Get: /api/posts?fields=title&populate[comments][pageSize]=5&populate[comments][page]=2
Result: It doesn't work (it returns all items in the populated field).

mohammadGh avatar Apr 07 '24 09:04 mohammadGh