Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-81792

Optimize $exists and $ne: null in the boolean expression simplifier

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

      1. If we have a positive predicate and {$exists: true} in one conjunction we can remove {$exists: true}. E.g.

      {a: {$eq: 1, $exists: true}} == {a: 1}

      2. The same idea with {$ne: null}:

      {a: {$eq: 1, $ne: null}} == {a: 1}

      3. A positive predicate and {$exists: false}:

      {a: {$eq: 1, $exists: false}} == {$alwaysFalse: true}

      4. A negative predicate and {$exists: false}:

      {a: {$ne: 1, $exists: false}} == {a: {$ne: 1}}

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            alexander.ignatyev@mongodb.com Alexander Ignatyev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: