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

Represent missing elements in objects

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Execution
    • ALL
    • QE 2024-03-18, QE 2024-04-01, QE 2024-04-15, QE 2024-04-29, QE 2024-05-13

      Assume a document 

      {_id: 0, time: new Date(1680912440), a: [{"b":3},{}]}

      and the query 

      {"a.b": {$eq: null}}

      SBE without block processing evaluates each element in the array and since the second object is empty it satisfies the predicate and the document is included in the result.

      In block processing, when we parse this document we record the value 3 for the first element and we ignore the second element because we do not record empty objects. When this block is later evaluated against the query the predicate is not satisfied and the document is not included in the result.

       

      As a second example, assume the document 

      {_id: 0, time: new Date(1680912440), a: [{"b":3},{"c":3}]}

      and the same query.

       

      Similarly to what happened in the first example, SBE without block processing evaluates each element in the array and since the second object does not have b it satisfies the predicate and the document is included in the result. In block processing, we record 3 for the first object and ignore the second object because it does not have b and the document is not included in the result.

       

      We should not ignore an object that does not have a field in the path.

            Assignee:
            foteini.alvanaki@mongodb.com Foteini Alvanaki
            Reporter:
            foteini.alvanaki@mongodb.com Foteini Alvanaki
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: