-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.0.4
-
Component/s: JavaScript, Shell
-
ALL
-
(copied to CRM)
# Insert three integers db.test.insert({ nums: [NumberInt(1), NumberInt(2), NumberInt(3)] }) # Check the size db.test.stats() { "ns" : "mydb.test", "count" : 1, "size" : 56, "avgObjSize" : 56, "storageSize" : 4096, "numExtents" : 1, "nindexes" : 1, "lastExtentSize" : 4096, "paddingFactor" : 1, "flags" : 1, "totalIndexSize" : 8176, "indexSizes" : { "_id_" : 8176 }, "ok" : 1 } # Retrieve and save the doc back to the database > doc = db.test.findOne() > db.test.save(doc) # Size should be the same if array elements saved as ints. > db.test.stats() { "ns" : "mydb.test", "count" : 1, "size" : 116, "avgObjSize" : 116, "storageSize" : 4096, "numExtents" : 1, "nindexes" : 1, "lastExtentSize" : 4096, "paddingFactor" : 1.59, "flags" : 1, "totalIndexSize" : 8176, "indexSizes" : { "_id_" : 8176 }, "ok" : 1 }
The size increases because they are being re-saved as 64-bit floats and it increases by more than just 6 bytes because of padding factor.
- is depended on by
-
RUBY-430 Integers inside array are converted to float when retrieving a document previously saved with the mongo client
- Closed
- is duplicated by
-
SERVER-41876 db.<collection>.save() cause data type mismatch
- Closed
- is related to
-
MONGOSH-1032 NumberInt object wrapper is not displayed
- Closed
-
JAVA-832 NumberLong is not properly round tripped by the JSON serializer / deserializer
- Closed