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

db.stats() returns MongoServerError: scale has to be a number

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.2.1
    • Affects Version/s: None
    • Component/s: Shell API
    • Labels:
      None
    • 2
    • Not Needed
    • Iteration Tokyo

      Following SERVER-50756, there appears to be a problem with db.stats():

       

      There are two ways to call the referenced stats:
      db.runCommand({dbStats: 1, freeStorage: 1});
      db.stats({freeStorage: 1})

      In mongosh run: 
       
      test> db.stats({freeStorage: 1});
      MongoServerError: scale has to be a number > 0
       
      Expected: 
      Output similar to the runCommand call:
       
      test> db.runCommand({dbStats: 1, freeStorage: 1});
      {
       db: 'test',
       collections: 1,
       views: 0,
       objects: 1,
       avgObjSize: 36,
       dataSize: 36,
       storageSize: 20480,
       freeStorageSize: 0,
       indexes: 1,
       indexSize: 20480,
       indexFreeStorageSize: 0,
       totalSize: 40960,
       totalFreeStorageSize: 0,
       scaleFactor: 1,
       fsUsedSize: 46888751104,
       fsTotalSize: 62725623808,
       ok: 1,
       '$clusterTime': {
        clusterTime: Timestamp(
      
      { t: 1642786653, i: 1 }
      ),
        signature: {
         hash: Binary(Buffer.from("0000000000000000000000000000000000000000", "hex"), 0),
         keyId: Long("0")
        }
       },
       operationTime: Timestamp({ t: 1642786653, i: 1 })
      }
       
       
      

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            dave.cuthbert@mongodb.com Dave Cuthbert (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: