Allow $lookup without explicit join predicates

    • 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

      Consider the $lookup below:

      {
          "$lookup": {
              "from": "supplier",
              "pipeline": [],
              "as": "supplier",
          }
      } 

      It looks like a cartesian product because it does not specify any join predicates. However, if later in the query you would connect the supplier collection with collection X, and X itself with the base collection, then no cartesian product is required.

      We currently bail when we see an empty pipeline here. If the pipeline would have a single $match without join predicates, we'd bail here instead (because the implementation of SERVER-115666 is a bit too strict). We should support these cases, because they're not actually cartesian products.

            Assignee:
            Unassigned
            Reporter:
            Max Verbinnen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: