Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-1949

Allow explicit construction of Int64 objects

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.16.0
    • Affects Version/s: None
    • Component/s: None

      Opening this to track the idea of allowing Int64 objects to be constructed explicitly. This would allow users to guarantee that a 64-bit integer BSON type is passed to MongoDB in an outgoing command.

      That said, it's quite possible that the field type might later change when round-tripping the document, since a 64-bit integer type whose value is within the 32-bit range of signed integers would be narrowed back to a 32-bit integer type (unless the user again explicitly wrapped it with an Int64 object). I suppose an ODM would be able to work around that by enforcing specific typing for fields, and at the very least we'd still be removing one limitation from the driver (that being no direct construction of Int64 types).

      This ticket was prompted by the following recent comments on older GitHub issues:

            Assignee:
            andreas.braun@mongodb.com Andreas Braun
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: