MongoDB: 64-bit Integers in PHP
Derick Rethans explains the impact in PHP of one of the 5 MongoDB assumptions: “the machine is 64-bit”:
MongoDB stores documents internally in something called BSON (Binary JSON). BSON has two integer types, a 32-bit signed integer type called INT and a 64-bit signed integer type called LONG. 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.
There’s also a MongoDB JIRA ticket you can watch about this issue ☞ here.
Original title and link for this post: MongoDB: 64-bit Integers in PHP (published on the NoSQL blog: myNoSQL)