Translate JOIN-over-UNNEST to $unwind

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Query
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Support the HQL JOIN pattern over an embedded array via UNNEST, translating it to MongoDB's $unwind + $match pipeline.

      Example HQL:

      SELECT c, li FROM Cart c JOIN LATERAL UNNEST(c.lineItems) li WHERE li.sku = 'WIDGET-1' AND li.qty > 2
      

      Expected MQL:

      [
        { "$unwind": "$lineItems" },
        { "$match": { "lineItems.sku": "WIDGET-1", "lineItems.qty": { "$gt": 2 } } }
      ]
      

      This shape multiplies rows: one result row per matching lineItem, exactly like a relational join. Unlike the EXISTS shape (which maps to $elemMatch and preserves parent cardinality), this requires $unwind to materialize each array element as a separate document.

            Assignee:
            Unassigned
            Reporter:
            Jeffrey Yemin
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: