[SERVER-16] dbcursor.count() should update based on limit() and skip() Created: 14/Apr/09 Updated: 08/Feb/23 Resolved: 27/May/09 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Liam Staskawicz | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
After retrieving a cursor from a query, calling count() on it always returns the total number of matching records, even after calling limit() or skip() on it. It would be nice if count() was updated to reflect the number of matching records after any cursor manipulation with limit() and skip(). This would ideally be a universal change for the various drivers as well to maintain consistent behavior, but I did not create issues specifically for each of them. Perhaps if this is accepted, that kind of change could be considered. |
| Comments |
| Comment by Liam Staskawicz [ 14/Apr/09 ] |
|
Perhaps there could be a new method added to the DBCursor class that could provide this additional functionality? |
| Comment by Jonathan Moss [ 14/Apr/09 ] |
|
I disagree. Personally I think this is ideal for pagination of results. With other DB system you need to perform 2 queries to do this. 1 to get the total count So my vote would be to keep the existing functionality as I cannot think of a suitable use case for this change. |