You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Indexes and Performance](#indexes-and-performance)
10
8
-[Cursors](#cursors)
11
9
-[Standard Cursor](#standard-cursor)
@@ -24,7 +22,7 @@ Mongoid extension that enables infinite scrolling for `Mongoid::Criteria` and `M
24
22
25
23
## Compatibility
26
24
27
-
This gem supports Mongoid 5, 6, 7 and 8.
25
+
This gem supports Mongoid 6, 7 and 8.
28
26
29
27
## Demo
30
28
@@ -51,8 +49,6 @@ gem 'mongoid-scroll'
51
49
52
50
## Usage
53
51
54
-
### Mongoid
55
-
56
52
A sample model.
57
53
58
54
```ruby
@@ -106,27 +102,6 @@ Feed::Item.desc(:position).limit(5).scroll(saved_iterator.next_cursor) do |recor
106
102
end
107
103
```
108
104
109
-
### Mongo-Ruby-Driver (Mongoid 5)
110
-
111
-
Scroll a `Mongo::Collection::View` and save a cursor to the last item. You must also supply a `field_type` of the sort criteria.
112
-
113
-
```ruby
114
-
saved_iterator =nil
115
-
client[:feed_items].find.sort(position:-1).limit(5).scroll(nil, { field_type:DateTime }) do |record, iterator|
116
-
# each record, one-by-one
117
-
saved_iterator = iterator
118
-
end
119
-
```
120
-
121
-
Resume iterating using the previously saved cursor.
122
-
123
-
```ruby
124
-
session[:feed_items].find.sort(position:-1).limit(5).scroll(saved_iterator.next_cursor, { field_type:DateTime }) do |record, iterator|
125
-
# each record, one-by-one
126
-
saved_iterator = iterator
127
-
end
128
-
```
129
-
130
105
## Indexes and Performance
131
106
132
107
A query without a cursor is identical to a query without a scroll.
@@ -212,4 +187,4 @@ Fork the project. Make your feature addition or bug fix with tests. Send a pull
212
187
213
188
MIT License, see [LICENSE](http://github.com/mongoid/mongoid-scroll/raw/master/LICENSE.md) for details.
214
189
215
-
(c) 2013-2023[Daniel Doubrovkine](http://github.com/dblock), based on code by [Frank Macreery](http://github.com/macreery), [Artsy Inc.](http://artsy.net)
190
+
(c) 2013-2024[Daniel Doubrovkine](http://github.com/dblock), based on code by [Frank Macreery](http://github.com/macreery), [Artsy Inc.](http://artsy.net)
0 commit comments