[SERVER-72450] $or with regex to $in rewrite depends on terms order Created: 30/Dec/22  Updated: 29/Oct/23  Resolved: 27/Mar/23

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

Type: Bug Priority: Major - P3
Reporter: Arun Banala Assignee: Timour Katchaounov
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-72416 The find and findAndModify projection... Closed
is related to SERVER-34012 Planner's logic for taking union of i... Closed
Assigned Teams:
Query Optimization
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.3, v6.0, v5.0
Sprint: QO 2023-01-23
Participants:

 Description   

While working on SERVER-72416, I've noticed that the or_to_in.js is breaking when there is a collection level collation and no collation for the query. This is likely because the re-write logic is not handling re-writes properly and the assertions in the or_to_in.js are incorrect. I've also noticed that this and this assertions are not doing anything, as they both generate the undefined value. The path for parsedQuery is plan.queryPlanner.parsedQuery. We should also fix this assertion after figuring out the expected correct behavior. ian.boros@mongodb.com pointed out that regex should not be collation aware. So we should probably disable all string and regex combination re-writes.



 Comments   
Comment by Timour Katchaounov [ 01/Jun/23 ]

These backports are required to address BF-28780.

Comment by Githook User [ 27/Mar/23 ]

Author:

{'name': 'Timour Katchaounov', 'email': 'timour.katchaounov@mongodb.com', 'username': 'timourk'}

Message: SERVER-72450 $or with regex to $in rewrite depends on terms order

Make the $or->$in rewrite indepent on the place where a regex appears in the $or.
Add tests to ensure the rewrite is order-independent.
Branch: master
https://github.com/mongodb/mongo/commit/b09d7d351ed9d2dcb807e7de79af65e93155175d

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