Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1124

show dbs shows size in 1000-based MB, legacy shell used 1024-based MB

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.1
    • Affects Version/s: None
    • Component/s: Embedded Shell
    • None
    • 3
    • Iteration Xochimilco, Iteration Zanzibar, Iteration Anemone
    • Not Needed

      Slack thread: https://mongodb.slack.com/archives/CUHC9R8J0/p1644801758947139
      Hello Team, Is it expected to see the difference between mongo and mongosh in terms of how the size is calculated? it looks like that mongo defines GB as 1,073,741,824 byte, and mongosh defines GB 1,000,000,000 byte[ec2-user@ip-10-0-0-161 ~]$ mongo --version
      MongoDB shell version v5.0.6[ec2-user@ip-10-0-0-161 ~]$ mongosh --version
      1.1.9 * mongosh(defines GB 1,000,000,000 byte)

      • mongos
        Enterprise [direct: mongos] test> show dbs
        test 2.3 GB
        MongoDB Enterprise mongos> db.stats().totalSize
        NumberLong("2299686912")
      • Shard1
        Enterprise myReplicaSet2 [direct: primary] test> show dbs
        test 676 MB
        Enterprise myReplicaSet2 [direct: primary] test> db.stats().totalSize
        675983360
      • Shard2
        Enterprise myReplicaSet2_1 [direct: primary] test> show dbs
        test 1.62 GB
        Enterprise myReplicaSet2_1 [direct: primary] test> db.stats().totalSize
        1623703552 * mongo (defines GB as 1,073,741,824 byte)
      • mongos
        MongoDB Enterprise mongos> show dbs
        test 2.142GB
        MongoDB Enterprise mongos> db.stats().totalSize
        NumberLong("2299686912")
        MongoDB Enterprise mongos>
      • Shard1
        MongoDB Enterprise myReplicaSet2:PRIMARY> show dbs
        test 0.630GB
        MongoDB Enterprise myReplicaSet2:PRIMARY> db.stats().totalSize
        675983360
      • Shard2
        MongoDB Enterprise myReplicaSet2_1:PRIMARY> show dbs
        test 1.512GB
        MongoDB Enterprise myReplicaSet2_1:PRIMARY> db.stats().totalSize
        1623703552 (edited)

            Assignee:
            leroux.bodenstein@mongodb.com Le Roux Bodenstein
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: