[SERVER-7267] Batch size + sort closes the cursor Created: 05/Oct/12 Updated: 12/Jun/14 Resolved: 07/Oct/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 2.2.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Gustavo Niemeyer | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
Batch size becomes limit if sort is appended to it: > db.test.insert( {n: 1}) ) ) ) ) > db.test.find().batchSize(2).sort( {n: 1}) { "_id" : ObjectId("506e43b5681e3dfd1b92980b"), "n" : 1 } { "_id" : ObjectId("506e43b7681e3dfd1b92980c"), "n" : 2 }> db.test.find().batchSize(2) { "_id" : ObjectId("506e43b5681e3dfd1b92980b"), "n" : 1 } { "_id" : ObjectId("506e43b7681e3dfd1b92980c"), "n" : 2 } { "_id" : ObjectId("506e43b8681e3dfd1b92980d"), "n" : 3 } { "_id" : ObjectId("506e43b9681e3dfd1b92980e"), "n" : 4 } { "_id" : ObjectId("506e43ba681e3dfd1b92980f"), "n" : 5 }The problem seems to be in the server. I can reproduce the same issue with the Go driver. |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 07/Oct/12 ] |
| Comment by Gustavo Niemeyer [ 05/Oct/12 ] |
|
This is probably related to mongo refusing to return a cursor with in-memory sorts. It'd be nice to make the behavior more user-friendly somehow to avoid the surprise. |