• Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Similar to matcher::narrowPath (SERVER-134593, SERVER-135339, SERVER-134936), but for aggregation pipelines!

      It should accept the PathSemantics defined in SERVER-135978. 

      Type narrowPath(Type inputType, FieldPath path, PathSemantics semantics,  Type constraint, bool assumeTrue);

      And will produce a Type derived from inputType which is narrowed by the constraint type.

      We will only implement PathSemantics::kFieldPath, but we should support dotted paths!

      Examples:

      • {a: any, b: any}

        with path 'a' with constraint number produces {a: number, b: any}

      • {a: any, b: any}

        with path 'a.b' with constraint number produces {a:

        {b: number}

        , b: any}

        • This is similar to {$expr: {$isNumber: '$a.b'}} for example which implies 'a' is non-array since the result is number.
        • Or {$expr: {$eq: ['$a.b', 1]}} which also implies non-array, but the type returned here should be {a: {b: number(S)}} (only subset of numbers).

       

            Assignee:
            Unassigned
            Reporter:
            Vesko Karaganev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: