[SERVER-78875] ParsedDistinct::asAggregationCommand() should return an AggregationRequest, not a BSONObj Created: 11/Jul/23  Updated: 18/Jul/23

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: David Percy Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-28177 query_request_helper::asAggregationCo... Closed
Assigned Teams:
Query Optimization
Participants:

 Description   

Since a view is defined by an aggregation pipeline, we convert any count, distinct, or find command request to an equivalent aggregation command.

For the distinct command, this is accomplished with ParsedDistinct::asAggregationCommand(). Currently this returns a BSONObj, which we almost always parse immediately into an AggregationRequest. For performance and simplicity, we should change these methods to return a StatusWith<AggregationRequest> directly.

Also, if the caller always uses uassertStatusOK on the result, we can further simplify by returning AggregationRequest directly, and throwing an exception in the error case.


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