MQL syntax for join on collection such that only non-matching documents are returned

XMLWordPrintableJSON

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

      For example, say you want all documents with key A in collA such that there are no documents in collB with key B = A. Expressing that in MQL can be done (inefficiently) as:

      {$lookup: {
        from: collB,
        localField: A,
        foreignField: B,
        as: b
      }},
      {$match: {b: {$eq: []}}}

      Maybe we could have like a $inverseLookup or a $diff or similar (even as an internal stage) to avoid materializing the results of a $lookup just so we can discard them in the next stage.

            Assignee:
            Unassigned
            Reporter:
            Alya Berciu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: