Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-92419

shardedDataDistribution returns null for ownedSizeBytes if there are no documents

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 8.0.0-rc14
    • 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.

            Assignee:
            silvia.surroca@mongodb.com Silvia Surroca
            Reporter:
            silvia.surroca@mongodb.com Silvia Surroca
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: