The timestamp field of an ObjectId is supposed to be an unsigned 32-bit integer but PyMongo encodes and decode it as a signed integer. This causes problems when the timestamp is larger than 31bits:
>>> struct.pack(">i", 0x80000000) Traceback (most recent call last): File "<stdin>", line 1, in <module> struct.error: 'i' format requires -2147483648 <= number <= 2147483647 >>> struct.pack(">I", 0x80000000) '\x80\x00\x00\x00'
- is related to
-
PYTHON-1619 Implement ObjectID spec
- Closed