We are migrating some data from MySQL to Mongo and have been adding extra fields to some of our DB tables for the ObjectId value of the migrated data objects.
At the mo
The range of a 12-byte unsigned int would be 0..79228162514264337593543950335
(29 digits max); according to docs (same URL you cited), a DECIMAL
/NUMERIC
column packs each group of nine base10 digits into four bytes (adding up to floor(29 / 9) * 4 = 3 * 4 = 12
bytes for the first 27 digits), with the remaining 2 digits taking an additional byte, coming up to 13 bytes of storage for a DECIMAL(29)
column.
Or, you can store them as BINARY(12)
.