-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Problem Statement:
Any Source stages in $unionWith sub-pipelines that reference unavailable metadata (e.g., {$meta: "textScore"}) do not throw validation errors during dependency analysis. Instead, they silently return empty documents at runtime.
Analysis:
DocumentSourceUnionWith::getDependencies() creates a DepsTracker with the default constructor, which uses NoMetadataValidation() and disables metadata validation. This means when stages call setNeedsMetadata(), validation is skipped.
Additionally, source stages short-circuit early in {{ pipeline_d.cpp::buildInnerQueryExecutor() }}, so they never reach the validateMetaDependencies() call in buildInnerQueryExecutorGeneric(). This means the only validation opportunity is during optimization phase.
Therefore, source stages (including) in $unionWith sub-pipelines referencing missing metadata do not fail validation.