[SERVER-36731] Ban object inequality and $in with unsupported values when using allPaths indexes Created: 17/Aug/18  Updated: 29/Oct/23  Resolved: 20/Sep/18

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 4.1.4

Type: Bug Priority: Major - P3
Reporter: Ian Boros Assignee: Ian Boros
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-36793 Ban $in queries for allPaths indices ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 2018-09-10, Query 2018-09-24, Query 2018-10-08
Participants:

 Description   

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



 Comments   
Comment by Githook User [ 20/Sep/18 ]

Author:

{'name': 'Ian Boros', 'email': 'ian.boros@10gen.com'}

Message: SERVER-36731 Ban object inequality and $in with unsupported values when using allPaths indexes
Branch: master
https://github.com/mongodb/mongo/commit/5ed54bec92fc15009877e2d579fe59785bffdde7

Comment by Ian Boros [ 06/Sep/18 ]

I think we also need to ban object equality (oops...). I plan on including that in this ticket.

Generated at Thu Feb 08 04:43:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.