When the collStats command is given a scale value that is too large for the integer type, a 4.4 server may fail with a BadValue error. This behavior was addressed in 4.9 and 5.0 when the collStats option handling was converted to using a IDL-generated parser that uses BSONElement::safeNumberInt().
4.4.5: > db.t.insert({_id: 0}) WriteResult({ "nInserted" : 1 }) > db.t.stats().storageSize 4096 > db.t.stats(100).storageSize 40 > db.t.stats(Number.MAX_VALUE).storageSize > db.t.stats(Number.MAX_VALUE) { "ns" : "test.t", "ok" : 0, "errmsg" : "scale has to be >= 1" } 4.9.0-rc1: > db.t.insert({_id: 0}) WriteResult({ "nInserted" : 1 }) > db.t.stats().storageSize 4096 > db.t.stats(100).storageSize 40 > db.t.stats(Number.MAX_VALUE).storageSize 0
- is related to
-
SERVER-54470 Add $collStats aggregate pipeline stage to API version 1
- Closed
-
SERVER-56689 mongos collStats does not handle large values for scale
- Closed
-
SERVER-52545 Specify input/output to listIndexes command in IDL
- Closed
-
SERVER-43902 Apply scaling for totalIndexSize after summing the sizes from individual shards
- Closed