[SERVER-79136] Incorrect query result of $match + $group on metaField over time-series Created: 19/Jul/23 Updated: 29/Oct/23 Resolved: 24/Jul/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 6.0.8, 7.0.0-rc8 |
| Fix Version/s: | 7.1.0-rc0, 5.0.20, 6.0.9, 7.0.0-rc9 |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Irina Yatsenko (Inactive) | Assignee: | Irina Yatsenko (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Operating System: | ALL | ||||
| Backport Requested: |
v7.0, v5.0
|
||||
| Sprint: | QI 2023-07-24, QI 2023-08-07 | ||||
| Participants: | |||||
| Description |
The result of the last query is incorrect – it should have been {_id: 1, m: 21}. The problem is with the $group rewrite that replaces "$group": {"_id": "$meta", "m": {"$min": "$val2" }} with "$group": {"_id": "$meta", "m": {"$min": "$control.min.val2"}} without taking in account that the minimum should be computed over a subset of the bucket. |
| Comments |
| Comment by Githook User [ 31/Jul/23 ] |
|
Author: {'name': 'Arun Banala', 'email': 'arun.banala@mongodb.com', 'username': 'banarun'}Message: (cherry picked from commit 1a6d2cc2f17e91f81714b009ee7840c1099f5440) |
| Comment by Githook User [ 27/Jul/23 ] |
|
Author: {'name': 'Arun Banala', 'email': 'arun.banala@mongodb.com', 'username': 'banarun'}Message: (cherry picked from commit 1a6d2cc2f17e91f81714b009ee7840c1099f5440) |
| Comment by Irina Yatsenko (Inactive) [ 24/Jul/23 ] |
|
There are two bugs in the same area here. One was introduced by https://jira.mongodb.org/browse/SERVER-67780 which fixed yet another incorrect query re-write and dates back to 5.0. The other one might have been in since the original implementation of the group rewrites that were added to 5.0 per |
| Comment by Githook User [ 24/Jul/23 ] |
|
Author: {'name': 'Arun Banala', 'email': 'arun.banala@mongodb.com', 'username': 'banarun'}Message: (cherry picked from commit 1a6d2cc2f17e91f81714b009ee7840c1099f5440) |
| Comment by Githook User [ 21/Jul/23 ] |
|
Author: {'name': 'Arun Banala', 'email': 'arun.banala@mongodb.com', 'username': 'banarun'}Message: |