Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mongoose-adapter] Bug with duplicate items when paginating results with sorting by not a unique field. #2840

Closed
shyshkovdev opened this issue Apr 27, 2020 · 2 comments

Comments

@shyshkovdev
Copy link

shyshkovdev commented Apr 27, 2020

This issue occurs when executing a query request with parameters "skip", "first" and "order by".
Screenshot from 2020-04-27 10-18-10
Screenshot from 2020-04-27 10-18-26
This issue is related to the use of the mongoose aggregate() method and it is thoroughly described on stackoverflow.com:
https://stackoverflow.com/questions/51805886/mongodb-aggregation-skip-and-limit-with-sorting-bring-duplicate-records-in-pagin
https://stackoverflow.com/questions/44692075/mongo-db-duplication-issue-while-using-sorting-with-limit-and-skip-in-aggregatio

As a solution, you can add a default sorting parameter for a unique "id" field.

For example:
$sort:{
some_not_unique_field: 1,
_id: 1
}

@stale
Copy link

stale bot commented Aug 25, 2020

It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)

@stale stale bot added the needs-review label Aug 25, 2020
@bladey
Copy link
Contributor

bladey commented Apr 8, 2021

Keystone 5 has officially moved into active maintenance mode as we push towards the next major new version Keystone Next, you can find out more information about this transition here.

In an effort to sustain the project going forward, we're cleaning up and closing old issues such as this one. If you feel this issue is still relevant for Keystone Next, please let us know.

@bladey bladey closed this as completed Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants