-
Notifications
You must be signed in to change notification settings - Fork 4
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
Event ordering when setting pageSize is wrong #46
Comments
Is there anything more to this than just sorting allEvents before returning from GetEvents? We could maintain allEvents as a sorted slice at all time rather than just appending the events (line 191) but I don't know if that would actually be more efficient (and if it would matter given the relatively small number of elements). eiffel-goer/internal/database/drivers/mongodb/mongodb.go Lines 157 to 201 in d4f7bb3
|
Description
The ordering of events in the event repository is such that the latest event comes last and the oldest event comes first, this means that when we limit the size of the page with
pageSize
we will only get the oldest event instead of the latest.It is possible to get the latest event if
pageNo
is set tototalNumberItems
, but that just feels weird.Motivation
I want to limit my query to the ER so that I only get the latest event.
Exemplification
Limiting the database & ER query in order to play nice with the services by setting
pageSize=1
is not really possible.Benefits
Easier to play nice with the service.
Possible Drawbacks
None
The text was updated successfully, but these errors were encountered: