[SERVER-10370] Count does not obey limit() Created: 29/Jul/13  Updated: 10/Dec/14  Resolved: 29/Jul/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.5.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: David Hows Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Participants:

 Description   

Count does not obey limit() parameter when passed. Limiting the range of a count can be useful when you only wish to know if you have at least a certain number of matching documents.

Count

> db.foo.find().limit(100).count();
2994

Itcount

> db.foo.find().limit(100).itcount();
100



 Comments   
Comment by Scott Hernandez (Inactive) [ 29/Jul/13 ]

You have to pass count a true argument to include the skip/limit.

> db.coll.find().limit(100).count(true)
100
> db.coll.find().count
function ( applySkipLimit ){ ... }

Comment by Eliot Horowitz (Inactive) [ 29/Jul/13 ]

SERVER-16

Generated at Thu Feb 08 03:22:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.