Allow $or allow pushdown when source and destination are inside the same $elemMatch

    • 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

      Follow-up from SERVER-125555.

      db.c.createIndex({"arr.a": 1, "arr.b": 1});  
      db.c.find({arr: {$elemMatch: {a: {$ne: 1}, $or: [{b: {$lt: 2}}, {b: {$gt: 3}}]}}}).explain();  
      

      On 7.0, we are able to do an $or pushdown, which is fine since the relevant part of the predicate is entirely beneath the $elemMatch:

      "indexBounds" : {  
          "arr.a" : [  
              "[MinKey, 1.0)",  
              "(1.0, MaxKey]"  
          ],  
          "arr.b" : [  
              "(3.0, inf.0]"  
          ]  
      }  
      

      However, after 8.0, we get [MinKey, MaxKey] bounds on "arr.b".

            Assignee:
            Unassigned
            Reporter:
            Henri Nikku
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: