Goodtimes! 64-bit Integers in MongoDB
Wednesday, August 11, 2010 at 9:00AM |
Derek Stainer Derick Rethans has an interesting article in which he attempts to store 64-bit integers in MongoDB using PHP. There are some pretty interesting caveats not only with MongoDB but PHP as well.
The documentation of the MongoDB PHP driver on types says (or used to say, depending on when you're reading this) that only the 32-bit signed integer type is supported because "PHP does not support 8 byte integers". That's not quite true. PHP's integer type supports 64-bit on the platforms where the C-data type long is 64 bits. That is generally on every 64-bit platform (where PHP is compiled for 64 bits); except on Windows, where the C-data type long is always only 32 bits.
In conclusion, Rethans offers some advice for others bravely choosing this path
Getting 64-bit support right with MongoDB can be tricky
Read more: 64-bit integers in MongoDB
Derick Rethans,
MongoDB,
PHP 
