[SERVER-70160] Do not push down $match that needs whole document before $internalUnpackBucket Created: 03/Oct/22  Updated: 29/Oct/23  Resolved: 05/Oct/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 5.0.13
Fix Version/s: 5.0.14

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

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:
Linked BF Score: 135

 Description   

The aggregation with a single $match stage over timeseries

 

[{"$match" : {"$expr" : {"$getField" : "measurement1"}}}] 

 

is incorrectly pushed before the internalUnpackBucket stage and evaluated to an empty document set.

This happens in DocumentSource::PushMatchBefore() function where the analysis misses the fact that the $match stage needs the entire document. https://github.com/mongodb/mongo/blob/v5.0/src/mongo/db/pipeline/document_source.cpp#L199



 Comments   
Comment by Githook User [ 05/Oct/22 ]

Author:

{'name': 'Milena Ivanova', 'email': 'milena.ivanova@mongodb.com', 'username': 'mivanova3'}

Message: SERVER-70160 'Do not push down $match that needs whole document
before $internalUnpackBucket'
Branch: v5.0
https://github.com/mongodb/mongo/commit/046163b1c2e362addef25f13a27b0d4575c1e98d

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