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

Accept integer types for Document array access

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.21.0
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • PHP Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      When modeling BulkWriteCommandResult, the operation results are BSON documents with numeric keys corresponding to the operation from the executed BulkWriteCommand. In my initial implementation of BulkWriteCommandResult, I decided to return the BSON documents directly as MongoDB\BSON\Document instances. PHPLIB can later utilize a codec to make working with these documents more convenient.

      The Document ArrayAccess methods and dimension handlers have historically required a string parameter type. Allowing an integer, which is then internally cast to a string, would make accessing results more convenient when working only with PHPC. No changes will be made for the strictly-typed API (e.g. get()) or property handlers (which receive zend_string parameters).

      PackedArray has similar logic that enforces an integer argument, but that can remain as-is.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: