[CSHARP-1030] Using Sort with Custom Batch Size Created: 12/Aug/14  Updated: 05/Apr/19  Resolved: 12/Aug/14

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

Type: Task Priority: Critical - P2
Reporter: Jeff Lemmerman Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

C# Driver 1.9.2 against single node MongoDB 2.4.4 running on Windows Server 2008R2 with 4GB RAM.


Issue Links:
Related

 Description   

The query below does not get results beyond the configured batch size (set to 1000). Removing the .SetSortOrder portion of the statement, the query functions as expected and retrieves results beyond initial batch size. However, the results are not sorted as desired.

var cursor = comps.Find(Query.EQ("ExperimentNumber", experimentNumber)).SetSortOrder(SortBy.Ascending("SerialNumber", "DateTime"));

Not including a batch size, the following error is thrown:
QueryFailure flag was too much data for sort() with no index. add an index or specify a smaller limit (response was

{ "$err" : "too much data for sort() with no index. add an index or specify a smaller limit", "code" : 10128 }

).

Both SerialNumber and DateTime are ascending indexes for the collection.
Total index size on collection is 1.1 GB.

I would like to understand what is necessary to create a query with a sort and page through results using a custom batch size.


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