[JAVA-4410] FindObservable skip and limit should be Long Created: 18/Nov/21 Updated: 27/Oct/23 Resolved: 06/Dec/21 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Unknown |
| Reporter: | Mayeul Marcadella | Assignee: | Jeffrey Yemin |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | external-user | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
FindObservable skip and limit should be Long otherwise it gets impossible to navigate in collections containing more than a couple of millions of records. |
| Comments |
| Comment by PM Bot [ 06/Dec/21 ] |
|
There hasn't been any recent activity on this ticket, so we're resolving it. Thanks for reaching out! Please feel free to comment on this if you're able to provide more information. |
| Comment by Jeffrey Yemin [ 21/Nov/21 ] |
|
It would still not be a good idea to use skip with that large a number. By its nature, the server can not use an index to efficiently skip that many records, so you're better off implementing pagination using an indexed field of some sort. See https://www.mongodb.com/blog/post/paging-with-the-bucket-pattern--part-1 for more details on the problem and some ideas for solutions. |
| Comment by Mayeul Marcadella [ 21/Nov/21 ] |
|
Actually, the limit is probably fine because querying more than 2 billion records is rather unlikely. However it is not so hard to imagine a dataset containing more than 2 billion entries. I am working with covid19 data and we currently have 2 million records, but the curve is clearly exponential. |
| Comment by Jeffrey Yemin [ 20/Nov/21 ] |
|
The maximum value of a 32-bit signed integer is 2,147,483,648. Do you have a use case for skip and limit where that number would be insufficient? |
| Comment by Esha Bhargava [ 20/Nov/21 ] |
|
mayeul.marcadella@gmail.com Thank you for reporting this issue! We'll look into it and get back to you soon. |