[SERVER-75670] Prevent dependency analysis from marking excluded fields as generated Created: 04/Apr/23  Updated: 29/Oct/23  Resolved: 05/Apr/23

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

Type: Bug Priority: Major - P3
Reporter: Ben Shteinfeld Assignee: Ben Shteinfeld
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
Sprint: QO 2023-04-17
Participants:
Linked BF Score: 151

 Description   

SERVER-25120 introduced a concept of generated fields in the context of pipeline dependency analysis. This allowed us to avoid pushing down fields into the PlanStage/find layer which were actually introduced (generated) later in the pipeline. The implementation treats exclusion projections as fields which are generated. The problem with this is that if we later has an inclusion projection on the same field, we omit that field as a dependency for the pipeline and don't pushdown the field to the find layer. This is ok for non-dotted paths, for yields different results for dotted paths.

db.c.insert({"_id": 1, "obj": {"str": "abc"}})
db.c.aggregate([{$project: {"obj.str": 0}}, {$project: {"obj.str": 1}}])
 
// Before SERVER-25120
[{_id: 1, obj: {}}]
 
// After SERVER-25120
[{_id: 1}]

We need to pushdown 'obj.str' into the find layer to maintain correct query results.



 Comments   
Comment by Githook User [ 05/Apr/23 ]

Author:

{'name': 'Ben Shteinfeld', 'email': 'ben.shteinfeld@mongodb.com', 'username': 'bshteinfeld'}

Message: SERVER-75670 Avoid marking excluded fields in projection as 'generated' during pipeline dependency analysis.
Branch: master
https://github.com/mongodb/mongo/commit/94ac53cc26b9dd35aa91ecd34c8f0e440f4ae70c

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