[SERVER-42929] Re-implement $replaceRoot in terms of root-replacing projection expression Created: 20/Aug/19  Updated: 19/Nov/19  Resolved: 19/Nov/19

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

Type: Improvement Priority: Major - P3
Reporter: Ian Boros Assignee: Ian Boros
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-42495 Integrate find() post-processing logi... Closed
Sprint: Query 2019-12-02
Participants:

 Description   

Once we have the execution machinery that allows projections to replace the root of a document with the result of an Expression, we can re-implement $replaceRoot in terms of this machinery.



 Comments   
Comment by David Storch [ 19/Nov/19 ]

No objections. Let's close as "Won't Do".

Comment by Ian Boros [ 18/Nov/19 ]

Given that we do not serialize root replacement expressions in the ProjectionExecutor, I think replacing ReplaceRootTransformation (here) would end up adding complexity.

Another option is to keep ReplaceRootTransformation, and have it delegate to the ProjectionExecutor for "execution." However, there's clearly a lot of care put into $replaceRoot reporting errors correctly (see here). For us to switch over to the ProjectionExecutor would involve plumbing some of the information like the stage name into ProjectionExecutor, which I'd like to avoid.

I'd like us to consider closing this as "Won't Fix" rather than adding complexity to our codebase for what I would argue is little/no benefit.

david.storch anton.korshunov would either of you object?

Generated at Thu Feb 08 05:01:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.