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

Restrict cases where isCoveredNullQuery can apply

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.1, 6.0.3, 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Minor Change
    • ALL
    • v6.1, v6.0
    • Hide

      See HELP-38275.

      There is an additional case where we run into a similar problem:

      db.coll.insertMany([{_id: 1, "a" : [ 1, 2, 3 ] }, {_id: 2, a: null}])

      db.coll.aggregate({$match: {a: {$in: [[2], null, []]}}}, {$project: {_id: 1}}) -> returns {_id: 2}

      db.coll.createIndex({a: 1})

      db.coll.aggregate({$match: {a: {$in: [[2], null, []]}}}, {$project: {_id: 1}}) -> returns {_id: 1} and {_id: 2}

      Show
      See HELP-38275. There is an additional case where we run into a similar problem: db.coll.insertMany([{_id: 1, "a" : [ 1, 2, 3 ] }, {_id: 2, a: null}]) db.coll.aggregate({$match: {a: {$in: [ [2] , null, []]}}}, {$project: {_id: 1}}) -> returns {_id: 2} db.coll.createIndex({a: 1}) db.coll.aggregate({$match: {a: {$in: [ [2] , null, []]}}}, {$project: {_id: 1}}) -> returns {_id: 1} and {_id: 2}
    • QO 2022-10-17, QO 2022-10-31, QO 2022-11-14

      There are additional cases where we cannot use an index to cover a null query when we have multiple clauses in $or or $in. We should make sure to add a FETCH stage above the index scan when the index scan bounds are not exact for the non-null part of the predicate, even if we can cover the null part of the query.

            Assignee:
            alya.berciu@mongodb.com Alya Berciu
            Reporter:
            alya.berciu@mongodb.com Alya Berciu
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: