[SERVER-75545] Expand a compound wildcard index always for queries on regular fields Created: 31/Mar/23  Updated: 29/Oct/23  Resolved: 04/Apr/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0-rc0

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

Issue Links:
Depends
Problem/Incident
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QE 2023-04-03
Participants:
Linked BF Score: 135

 Description   

There is a false assumption that there's no need to expand a CWI if its wildcard component has been expanded to some specific field.

Imagine we have a $or query: { $or: [\{a: {$gt: 10}}, \{"sub.a": {$gt: 5}}]} and a CWI {a: 1, "sub.$**": 1}.  The current expanding logic only expands the CWI to an IndexEntry with {a: 1, "sub.a": 1} because "sub.a" is relevant to this CWI. However, the first predicate of the $or - {a: {$gt: 10}} should actually be answered by an expanded IndexEnty w/o specific expanded field, because these two expanded IndexEntrys generate IndexBounds.



 Comments   
Comment by Githook User [ 04/Apr/23 ]

Author:

{'name': 'Ruoxin Xu', 'email': 'ruoxin.xu@mongodb.com', 'username': 'RuoxinXu'}

Message: SERVER-75545 Expand a compound wildcard index always for queries on regular fields
Branch: master
https://github.com/mongodb/mongo/commit/cb71fd5563fa51c8505bf28d9376e24d069eb72f

Generated at Thu Feb 08 06:30:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.