[CSHARP-309] Change argument type to long Created: 24/Aug/11 Updated: 20/Mar/14 Resolved: 13/Sep/11 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.1 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Timofei Mironov | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | driver | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Driver 1.1 |
||
| Backwards Compatibility: | Major Change |
| Description |
|
In version 1.1 you changed type of return value of .Count() to long but we can't skip some long-size items becasue MongoCursor<T>.SetSkip and MongoCursor<T>.SetLimit() Please fix it. |
| Comments |
| Comment by Robert Stam [ 25/Aug/11 ] |
|
This algorithm for paging will only work it the total count of documents in the collection is not too large. If you know in advance that the count is reasonable, you could just change the code like this: var total = (int) cursor.Count(); // we know the count is small and will fit in an int |
| Comment by Timofei Mironov [ 25/Aug/11 ] |
|
Actualy not, we don't use large values for skip. long total = cursor.Count() cursor.Find(...).SetSkip(skip); // but argument is int I know that this situation looks like a joke, because of what is the paging where count of pages is long. |
| Comment by Robert Stam [ 24/Aug/11 ] |
|
I don't think it makes sense to use 64 bit values here. If you are skipping more than 2^31 results the cursor will timeout before ever returning the first document. And normally the limit value will be relatively small also, on the order of a few hundred or thousand, and certainly less than 2^31. What is your use case? Are you actually using large values for Skip and Limit? |