Details
-
Improvement
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
None
-
Query Optimization
Description
During code review of SERVER-76042 which refactored this API, we noticed it was a little confusing:
/** |
* For testing or for internal clients to use.
|
*/
|
|
|
/** |
* Used for creating sub-queries from an existing CanonicalQuery.
|
*
|
* 'root' must be an expression in baseQuery.root().
|
*
|
* Does not take ownership of 'root'.
|
*/
|
static StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(OperationContext* opCtx, |
const CanonicalQuery& baseQuery, |
MatchExpression* root);
|
The comments and confusion were around:
davis.haupt@mongodb.com: don't we already have a MatchExpression* and a CanonicalQuery in this function? why re-parse here?
It looks like the old code also re-parsed. I do think it would be useful to add a comment here about why it's necessary, though
jacob.evans@mongodb.com: looks like this reroots just the find portion of the query for testing? should we consider changing the name? or filing something to delete it if it's underutilized
Attachments
Issue Links
- is related to
-
SERVER-76042 Avoid re-parsing match, sort and projection expressions in registerFindRequest
-
- Closed
-