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

Ban object inequality and $in with unsupported values when using allPaths indexes

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.4
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Fully Compatible
    • ALL
    • Query 2018-09-10, Query 2018-09-24, Query 2018-10-08

      Example:

      db.c.insert({a: {b: 1}});
      const query = {a: {$lte: {c: 1}}};
      db.c.find(query); // Returns a document
      db.c.createIndex({"$**": 1})
      db.c.find(query); // Doesn't return a document because it tries to use the allPaths index with bounds [{}, {c: 1}]
      

      This ticket will also cover the work of making sure $in queries don't use the index when the $in contains a value which the index cannot support querying on. For example:

      db.c.drop();
       
      assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryAllowAllPathsIndexes: true}));
       
      db.c.insert({a: 1});
      db.c.insert({a: {b: 1}});
       
      assert.commandWorked(db.c.createIndex({"$**":1}));
       
      const query = {a: {$in: [1, {b: 1}]}};
      printjson(db.c.find(query).toArray());
      printjson(db.c.explain("allPlansExecution").find(query).finish());
      

            Assignee:
            ian.boros@mongodb.com Ian Boros
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: