What is going wrong? What action would you like the Engineering team to take?
`getShardDistribution` runs $collStats on all shards and then aggragates the results. To compute the total `count` of documents, it sums the `count` returned by each shard. $collStats uses the smallest possible type to report `count` (e.g. a plain integer if small, a Long if larger, etc.). When mongosh sums a plain integer with a Long, the result is concatenated, rather than summed. Thus, the reported count is incorrect.
The same issue happens with the 'data' size field.
Please be sure to attach relevant logs with any sensitive data redacted.
How could an engineer replicate the issue you’re reporting?
Create a sharded collection, where one shard has a number of documents greater than 2^32, and the other has a smaller number of documents.
What do you expect to happen?
getShardDistribution is expected to return a correct total count.
What do you observe is happening?
getShardDistribution will return an incorrect 'total count'.
Any additional information that may be useful to include.