Implement wild card syntax for typemap field paths

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 1.5.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Implement an extension to the typemap system by allowing wild card field paths which contain a BSON array or BSON document to be converted to an array, stdClass, or object of a specific type.

      This adds the "$" syntax to the "fieldPath" field to the TypeMap options as follows:

      [
        ‘root’ => (object|array|classname),
        ‘document’ => (object|array|classname),
        ‘array’ => (object|array|classname),
        // overrides defaults but not __pclass (“fieldPaths” name may change)
        ‘fieldPaths’ => [
          ‘Object’ => (object|array|classname),
          ‘Object.bob’ => …,
          ‘Object.jim.0’ => …,
          ‘Object.jim.1’ => …,
          ‘Object.jim.$’ => …,
          ‘Object.$’ => …,
         ],
      ];
      

      The order of the entries in the fieldPaths matters. The first "match" for each field path will be used. So for "Object.jim.1", the specific entry is used, but for "Object.jim.4", the entry associated with "Object.jim.$" will be used.

            Assignee:
            Derick Rethans
            Reporter:
            Derick Rethans
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: