|
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());
|
|