-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 6.0.16, 7.3.3, 7.0.12, 8.0.0-rc13
-
Component/s: None
-
None
-
Catalog and Routing
-
Fully Compatible
-
v8.0, v7.3, v7.0, v6.0
-
CAR Team 2024-07-22
The aggregation stage $shardedDataDistribution returns null for both ownedSizeBytes and oprhanedSizeBytes fields when there are no documents on that collection.
> db.adminCommand({shardCollection: "dba.collA", key: {x:1}}) > db.aggregate([{$shardedDataDistribution:{}},{$match:{ns:{$eq:"dba.collA"}}}]) [ { ns: 'dba.collA', shards: [ { shardName: 'shard02', numOrphanedDocs: 0, numOwnedDocuments: 0, ownedSizeBytes: null, orphanedSizeBytes: null } ] } ]
We should return 0 instead of null for those cases.