[CSHARP-861] MongoCursor SetSkip() and SetLimit() should accept Int64 values Created: 07/Nov/13  Updated: 20/Mar/14  Resolved: 20/Mar/14

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.8.3
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Roman Kuzmin Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Presumably, MongoCursor methods SetSkip() and SetLimit() should accept Int64 values, not currently used Int32. Or at least such overloads should exist in MongoCursor. Int32 values may be not enough in some cases.



 Comments   
Comment by Robert Stam [ 07/Nov/13 ]

Skipping large amounts of data is going to be very slow. The server probably can't skip the data in O(1) time, and probably has to read the documents, or at least the index entries, in order to count them as it is skipping them. So even if we could make the Skip 64-bit you would never want to use Skip values that large.

It would be possible for Limit to be a 64-bit value, as the Limit is mostly implemented in the driver. There is a limit field in the wire protocol (called numberToReturn), but it is not an absolute limit, rather it is suggesting to the server how many documents to return in the next batch.

Comment by Roman Kuzmin [ 07/Nov/13 ]

Oh, I see.

How do we deal with big data, then? It's unlikely needed to query and get such a large number of documents, so Int32 SetLimit is probably fine. But we may what to skip large Int64 amount of data and then get some Int32 portion. Or we may just want to get Size() of data using SetSkip and SetLimit. Note that Size() is already Int64.

Comment by Robert Stam [ 07/Nov/13 ]

The corresponding fields in the wire protocol are only 32 bit, so this isn't really possible.

Generated at Wed Feb 07 21:38:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.