-
Type:
Improvement
-
Resolution: Won't Fix
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.6.5
-
Component/s: Querying
-
None
-
(copied to CRM)
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
MyColl has 20 documents, as count() and find().count() confirm, but adding limit(10) still returns 20:
db.MyColl.count() 20 db.MyColl.find().count() 20 db.MyColl.find().limit(10).count() 20
This is the correct syntax as per our documentation for cursor.count() - the default behaviour when applySkipLimit is not set to true is to ignore any skip(n) and limit(m) methods.
However, it is counter-intuitive for a user to have included the limit(10) but to also want it to be ignored. Note further that itcount() behaves differently:
db.MyColl.find().limit(10).itcount() 10
Conclusion: the default value for applySkipLimit should be true.