Inconsistent representation of resolved view pipelines and namespaces in explain across $lookup, $graphLookup, and $unionWith

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Aggregation stages that resolve views (such as $lookup, $unionWith, and $graphLookup) differ in how they serialize and report view information during explain:

      • In $lookup, when configured with a user-facing pipeline: [...], the resolved view pipeline is shown as part of the stage's pipeline output in explain. But when using localField/foreignField syntax without a pipeline, the view stages are omitted from explain. On mongos, $lookup rewrites from to the resolved backing namespace for explain.
      • In $unionWith, the stage prepares and explains the sub-pipeline during explain, displaying the inner plan or stages.
      • In $graphLookup, there is no user-facing pipeline option syntax. View pipelines are resolved and transferred on the wire via the internal field '$_internalFromPipeline', which is suppressed during explain to avoid leaking internal wire protocol fields. As a result, $graphLookup has no mechanism to expose the resolved view pipeline in explain output.

      We need to triage and design a consistent approach for:

      1. Exposing underlying view pipelines in explain output.
      2. Deciding whether from in explain should display the user-provided view name or the backing collection.

            Assignee:
            Unassigned
            Reporter:
            Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: