Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-1122

Support Document and PackedArray objects in public APIs

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

      Various APIs in PHPLIB accept arrays and objects for document parameters.

      Generally, these parameters are directly passed along to PHPC for BSON serialization. But in some cases, PHPLIB needs to inspect the document (e.g. differentiating update/replacement documents, generating index names). For example, when the object is an instance of MongoDB\BSON\Serializable we invoke bsonSerialize() and work with its return value. For other objects, get access the public properties with get_object_vars().

      Starting with PHPC 1.16, applications may utilize MongoDB\BSON\Document and MongoDB\BSON\PackedArray objects to represent raw BSON documents and arrays, respectively.

      We should ensure that Document is supported everywhere PHPLIB currently takes a document parameter.

      Some APIs will also need to be sensitive to PackedArray objects. For example, Update operations may need check if the update array|object parameter is a pipeline; however, Aggregate operations will continue to require a PHP array for their pipeline argument so this wouldn't apply there.

            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: