Rewrite LT and LTE predicates to their negation if field is provably not array

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

      If we know that a field path is not an array then in the boolean simplifer we can apply the following transformations:

      {a: {$lt: 1} } -> {a: {$not: {$gte: 1} } }
      {a: {$lte: 1} } -> {a: {$not: {$gt: 1} } }
      

      This reduces the number of unique predicates and enables simplifications such as in the following example (courtesy of alexander.ignatyev@mongodb.com:
      "a > 10 and a <= 10 without the transformation this is 2 different predicates: A and B, with the transformation it will be A and not A which is always false"

            Assignee:
            Unassigned
            Reporter:
            Naafiyan Ahmed
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: