Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-85586

Error if $lookup is specified with a foreign collection and an initial source in the pipeline

    • Type: Icon: Improvement Improvement
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization

      Aggregate commands like

       {aggregate: "foo", pipeline: [{$documents: [...]}], ...}

       fail with "'$documents' can only be run with {aggregate: 1}". However, a $lookup like

       {$lookup: {from: "foo", pipeline: [{$documents: [...]}], ...}}

       succeeds. While executing this $lookup, we will never look at the foreign collection, so it's confusing to allow it to be specified here. This ticket is to consider erroring for these $lookups, too.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            hana.pearlman@mongodb.com Hana Pearlman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: