[SERVER-26602] $lookup and $graphLookup should only fetch fields needed Created: 12/Oct/16  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: rroxy sam Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 4
Labels: optimization
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Query Optimization
Participants:

 Description   

$lookup is a great feature, but it must provide the option to limit the fields from joins



 Comments   
Comment by rroxy sam [ 22/Oct/16 ]

@Thomas. Thanks

Comment by Kelsey Schubert [ 15/Oct/16 ]

Hi rroxysam,

Thanks for confirming that you are using the $project stage after $lookup. I've modified this ticket to have the aggregation pipeline recognize this pattern and only fetch fields that are needed in subsequent stages. I believe this would accomplish the same goal, and users would need not modify their aggregation queries. Please continue to watch for updates.

Kind regards,
Thomas

Comment by rroxy sam [ 13/Oct/16 ]

@Thomas, Yes this is absolutely right & i did same in my scenario following $lookup stage with $project. But isn't be great if there is an option for projection in $lookup for retrieving only particular fields for the associate collection.

Comment by Kelsey Schubert [ 12/Oct/16 ]

Hi rroxysam,

Would following the $lookup stage with a $project stage work for your use case?

Thank you,
Thomas

Generated at Thu Feb 08 04:12:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.