Problem with using pagination and sorting by field with common values #2409
svntime
started this conversation in
Feature Requests & Ideas
Replies: 1 comment 3 replies
-
Hey @svntime — hmm, interesting. It looks like that Stackoverflow post suggests to just put the second sort on something like Either way, I think for now what you should do is try and set your And then I will convert this to a discussion, tag it as a feature request, and slate it into our roadmap 😎 |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Link to reproduction
https://github.com/svntime/payload-sorting-problem
To Reproduce
yarn dev _community
(default credentials: [email protected]:test)publicationDate
value)Note: you can also use below query on http://localhost:3000/api/graphql-playground
Describe the Bug
Hi there! I've just encountered a problem with using pagination and
sort
by field which is not unique. In my case, there is a field calledpublicationDate
which can be the same for multiple articles. When I try to query different pages, I get duplicate items in the response. Here is the example:As you can see,
post1
is present on both pages. It's probably related to https://stackoverflow.com/questions/44692075/mongo-db-duplication-issue-while-using-sorting-with-limit-and-skip-in-aggregatio but I didn't investigate it. If so, I don't think we can sort by multiple fields right now 😢 Maybe there is a simpler way?Thanks a lot!
Payload Version
1.6.26
Beta Was this translation helpful? Give feedback.
All reactions