[DOCS-13305] Investigate changes in SERVER-43816: Push $sort with $meta in the sort pattern into the PlanStage layer Created: 18/Dec/19 Updated: 13/Nov/23 Resolved: 28/Feb/20 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | manual, Server |
| Affects Version/s: | None |
| Fix Version/s: | 4.3.3, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Backlog - Core Eng Program Management Team | Assignee: | Jeffrey Allen |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Days since reply: | 3 years, 49 weeks, 5 days ago | ||||||||
| Epic Link: | DOCS: 4.4 Server Release Work | ||||||||
| Description |
DescriptionDownstream Change Summary I left a detailed comment on the ticket describing the behavior changes made under this ticket: The documentation for $meta will have to be updated to reflect these new behaviors: https://docs.mongodb.com/manual/reference/operator/projection/meta/ and https://docs.mongodb.com/manual/reference/method/cursor.sort/#metadata-sort. We will also have to update the documentation for $natural: https://docs.mongodb.com/manual/reference/method/cursor.sort/#return-in-natural-order and https://docs.mongodb.com/manual/reference/operator/meta/natural/#metaOp._S_natural. In particular, we need to remove the note saying that $natural sort cannot be used against a view. Description of Linked TicketWhen a $sort stage is at the beginning of the pipeline, or close to the beginning, the aggregation subsystem attempts to execute it using the underlying PlanStage query execution tree. We are trying to push increasingly more execution into the PlanStage layer in order to move towards having a single, unified execution engine which will be easier to extend and maintain. There is a special case where we don't push down $sort if it has "textScore" or "randVal" $meta expressions: see https://github.com/mongodb/mongo/blob/8ccaacce937ae51deef27c41e977aca0511fb338/src/mongo/db/pipeline/pipeline_d.cpp#L102-L120. For "textScore", this restriction stems from the fact that the find and agg systems have different validity rules for $meta sort by text score. The agg subsystem permits $meta:textScore with no matching $meta projection:
The find subsystem, on the other hand, requires a matching "textScore" $meta projection:
We should eliminate this restriction, which would allow us to always push down "textScore" $meta sort. The situation for "randVal" needs some investigation, but note Scope of changesImpact to Other DocsMVP (Work and Date)Resources (Scope or Design Docs, Invision, etc.) |
| Comments |
| Comment by Githook User [ 28/Feb/20 ] |
|
Author: {'username': 'jeff-allen-mongo', 'name': 'jeff-allen-mongo', 'email': 'jeffrey.allen@10gen.com'}Message: ( |