$lookup option to bypass

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: 4.2.1
    • Component/s: Aggregation Framework
    • None
    • Query Execution
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      It would be nice if there was a way to optionally bypass over a lookup stage based on a value in the document.

      Imagine pipeline of

      A,
      lookup B,
      unwind B,
      lookup C

      Where the relationship is many-to-zero A:B, zero-to-many B:C

      However, if there is no B records found, there is no point to do lookup C. In my scenario, the problem is that because there is no B, then the lookup C attempts to do a match on a null value, and the lookup C collection index is sparse. So the lookup is extremely slow due to no index.

      Could be avoided if there was a way to bypass the lookup based on the current document value.

      Let me know if this is unclear and I can draw up an example.

      Another simpler example might just be A lookup B, where A.value is null, and you don't want to bother doing a lookup against B since A.value is null.

              Assignee:
              [DO NOT USE] Backlog - Query Execution
              Reporter:
              Ben Rotz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: