[SERVER-69707] [SBE] Undefined slot error for $group with $cond / $switch / $ifNull expressions Created: 14/Sep/22  Updated: 29/Oct/23  Resolved: 16/Sep/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 6.0.1, 6.1.0-rc2
Fix Version/s: 6.0.2, 6.1.0-rc3, 6.2.0-rc0

Type: Bug Priority: Critical - P2
Reporter: Yoon Soo Kim Assignee: Yoon Soo Kim
Resolution: Fixed Votes: 0
Labels: sbe
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.1, v6.0
Sprint: QE 2022-09-19
Participants:
Case:

 Description   

We get undefined accessor error for the following pipeline.

db.b.explain().aggregate([
  {$match: { master: 1} },
  {$group: {"_id":"$status", "counter":{$sum:1}}},
  {$group: {
    "_id": null,
    "pending":{$sum: {$cond:[{$lte:["$_id",99]},"$count",0]}},
    "running":{$sum: {$cond:[{$gte:["$_id",100]},"$count",0]}}
  }}
]);



 Comments   
Comment by Githook User [ 16/Sep/22 ]

Author:

{'name': 'Yoonsoo Kim', 'email': 'yoonsoo.kim@mongodb.com', 'username': 'yun-soo'}

Message: SERVER-69707 Fix undefined slot error for $group with conditional expression

(cherry picked from commit 8e990303de72e04600770082e41aec92f6221c8b)
Branch: v6.0
https://github.com/mongodb/mongo/commit/52940805f01b2599ed6ed3221094716766e347ac

Comment by Githook User [ 16/Sep/22 ]

Author:

{'name': 'Yoonsoo Kim', 'email': 'yoonsoo.kim@mongodb.com', 'username': 'yun-soo'}

Message: SERVER-69707 Fix undefined slot error for $group with conditional expression

(cherry picked from commit 8e990303de72e04600770082e41aec92f6221c8b)
Branch: v6.1
https://github.com/mongodb/mongo/commit/3c4ff87b9f229f356eeda9ae833ccfd03ad127b0

Comment by Githook User [ 16/Sep/22 ]

Author:

{'name': 'Yoonsoo Kim', 'email': 'yoonsoo.kim@mongodb.com', 'username': 'yun-soo'}

Message: SERVER-69707 Fix undefined slot error for $group with conditional expression
Branch: master
https://github.com/mongodb/mongo/commit/8e990303de72e04600770082e41aec92f6221c8b

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