-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add a cursor to go to the first page #42
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Add to README please.
CHANGELOG.md
Outdated
@@ -1,6 +1,7 @@ | |||
### 2.0.0 (Next) | |||
|
|||
* [#38](https://github.com/mongoid/mongoid-scroll/pull/38): Allow to reverse the scroll - [@GCorbel](https://github.com/GCorbel). | |||
* [#42](https://github.com/mongoid/mongoid-scroll/pull/42): Add a cursor to go to the first page - [@GCorbel](https://github.com/GCorbel). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* [#42](https://github.com/mongoid/mongoid-scroll/pull/42): Add a cursor to go to the first page - [@GCorbel](https://github.com/GCorbel). | |
* [#42](https://github.com/mongoid/mongoid-scroll/pull/42): Add a `first` cursor - [@GCorbel](https://github.com/GCorbel). |
I think for #38 above we should say "Add a previous
cursor" too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed.
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
I added
first_cursor
to Mongoid::Scroll::Scrollable::Iterator.This is honestly kind of the same than
Feed::Item.asc(field_name).limit(2)
but allows to keep sort options encrypted the same way it is for other kind of cursors.We use it to have this kind of payload for an API response :
Given that, we can go to the first page at any time.