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

Aggregate rejects typeMap option when useCursor is false

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.3.1
    • Affects Version/s: 1.1.0
    • Component/s: None
    • None

      3b6b96e implemented a TypeMapArrayIterator class for PHPLIB-112, which was meant to apply to non-cursor results from an aggregate command; however, that commit never removed logic in the constructor that prohibited specifying a typeMap option if useCursor was false. Additionally, it did not remove logic in Collection::aggregate() to avoid inheriting the Collection's type map if useCursor was false.

      The fact that we never received bug reports for this is an indicator that there are likely very few users specifying a custom type map and/or disabling aggregation cursors. Additionally, there were no reports after 1.1.0 that non-cursor aggregate results were using PHPC's default type map (e.g. stdClass and arrays).

      In any event, both bits of logic above should be removed, despite non-cursor aggregation being deprecated in PHPLIB-304.

      Additionally, it'd be helpful to add a test for applying a type map to an inline aggregation operation, since that would have caught this sooner. That test should only run on servers before 3.6, since 3.6+ raises an error for inline aggregations.

            Assignee:
            katherine.walker@mongodb.com Katherine Walker (Inactive)
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: