Reputation: 11190
I'm trying to optimize DB size for a collection that contains a lot of documents. The documents have a number of properties that are represented by small integers (< 255). In the SQL Server world these would be stored as tinyint values, but the smallest BSON type I can find is Int32.
Are there an alternatives for efficiently storing small integers in MongoDB?
Upvotes: 7
Views: 2837
Reputation: 3580
Tinyint
data type is equal by Byte
(-256 < Byte < 255) and SmallInt
by Int16
.
But MongoDB stores data in a binary format called BSON which supports these numeric data types:
Reference:
Does MongoDB support floating point types?
Upvotes: 3