[SERVER-64764] $expr rewrite is not prepared to handle "$$ROOT" Created: 21/Mar/22  Updated: 29/Oct/23  Resolved: 22/Mar/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc0, 5.0.15

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

Issue Links:
Backports
Duplicate
is duplicated by SERVER-71045 Use of $$ROOT in $expr in $match fail... Closed
Problem/Incident
causes SERVER-65701 Avoid running expr.js in multiversion... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0
Sprint: QO 2022-04-04
Participants:
Linked BF Score: 40

 Description   

Currently it raises an assertion and fails the query as it tries to optimize this. I think this is a simple case to fix to just abandon optimization.

I also think that I introduced this accidentally during a refactor in https://github.com/mongodb/mongo/commit/0e967d6ed33cdf9eb8314e6ae3fb3e2261e213d7 (SERVER-53638)



 Comments   
Comment by Githook User [ 23/Nov/22 ]

Author:

{'name': 'Charlie Swanson', 'email': 'charlie.swanson@mongodb.com', 'username': 'cswanson310'}

Message: SERVER-64764 Fix '$$ROOT' handling in $expr rewrite
Branch: v5.0
https://github.com/mongodb/mongo/commit/b2fa75ac0b97688390df6ac7e2e8b0325e21e454

Comment by Charlie Swanson [ 10/Nov/22 ]

Requesting backport and marking SERVER-71045 as a duplicate

Comment by Githook User [ 22/Mar/22 ]

Author:

{'name': 'Charlie Swanson', 'email': 'charlie.swanson@mongodb.com', 'username': 'cswanson310'}

Message: SERVER-64764 Fix '$$ROOT' handling in $expr rewrite
Branch: master
https://github.com/mongodb/mongo/commit/0d406e15c35ab97afdc16b9be0b072d45280245b

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