-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
Fully Compatible
-
Query 2018-12-31, Query 2019-01-14, Query 2019-01-28, Query 2019-02-11, Query 2019-02-25
SERVER-37378 tracked the work to prevent the new "insertDocuments" and "replaceDocuments" $out modes from writing to the same namespace as the source of the aggregation. The existing "replaceCollection" mode is exempted from this restriction because this mode will write results to a temporary collection first. This means the intermediate results are not readable, and so this mode doesn't risk a server-side infinite-loop.
We should go one step further and prevent $out (with these new modes) from writing to the same namespace as any namespace read from in the pipeline, specifically including with a $lookup or $graphLookup.
It's unclear how we'll want to go about doing this, but the information about which namespaces are involved in the aggregation is most easily accessible from the LiteParsedPipeline. Unfortunately we don't have access to a LiteParsedPipeline at the time we are parsing an $out stage, so this check might have to live outside of DocumentSourceOut itself.
- depends on
-
SERVER-39394 Views collation check should traverse through nested $lookup pipelines
- Closed
- related to
-
SERVER-42137 Allow aggregation $merge stage to write to a collection that the query also reads from
- Closed