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

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

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Query Optimization

    Description

      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}}

      Attachments

        Activity

          People

            backlog-query-optimization Backlog - Query Optimization
            alexander.ignatyev@mongodb.com Alexander Ignatyev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: