[JAVA-661] DBCollection.count returns long, DBCursor.count truncates to int Created: 02/Oct/12  Updated: 12/Jul/13  Resolved: 12/Jul/13

Status: Closed
Project: Java Driver
Component/s: API, Command Operations
Affects Version/s: 2.8.0, 2.9.0, 2.9.1
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Matt Schemmel Assignee: Unassigned
Resolution: Won't Fix Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Major Change

 Description   

Similar to CSHARP-254.

Mongo does not limit the number of document to 2^32, so DBCollection has it right. DBCursor defers to the same server command, so there's no good reason to return something different here beyond not breaking code written against DBCursor.count. Currently, count on a cursor over a very large collection will truncate, which isn't great.

Adding this detail as a separate issue so that the fix can be included in some release where forcing some client-app cleanup is ok.



 Comments   
Comment by Jeffrey Yemin [ 12/Jul/13 ]

We've decided not to break binary compatibility, for the most part, even in 3.0. However, 3.0 will have a new cursor-like interface where count returns a long

Comment by Jeffrey Yemin [ 03/Oct/12 ]

This is an API change that breaks binary compatibility, so I'm putting it in the 3.0 bucket for a major release.

Comment by Matt Schemmel [ 02/Oct/12 ]

whether it's wise to have three billion documents in a query result is a different question...

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