[JAVA-489] Add DBCursor.count(boolean foundOnly) Created: 14/Dec/11  Updated: 19/Oct/16  Resolved: 19/Oct/16

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Uladzimir Mihura Assignee: Brendan W. McAdams
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

At this moment it's impossible to get the number of results with skip and limit applied:
http://api.mongodb.org/java/2.7.0/com/mongodb/DBCursor.html#count()

At the same time PHP and Python have this ability.



 Comments   
Comment by Uladzimir Mihura [ 16/Dec/11 ]

Thank you Brendan.

Looks strange that for different drivers we have different method names.

-vova

Comment by Brendan W. McAdams [ 14/Dec/11 ]

Count returns the total results of the cursor without skip/limit.

Calling size() instead will account for skip/limit as documented in the same Javadoc page.

Generated at Thu Feb 08 08:52:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.