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

$lookup option to bypass

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

      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:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            ben@ethika.com Ben Rotz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: