%dw 2.0
import * from dw::core::Arrays
var users = [
  {
    "id": 1,
    "name": "Jerney"
  },
  {
    "id": 2,
    "name": "Marty"
  },
  {
    "id": 3,
    "name": "Daren"
  }
]
var orders = [
  {
    "id": 12,
    "user_id": 1,
    "product": "ham"
  },
  {
    "id": 13,
    "user_id": 1,
    "product": "broccoli"
  },
  {
    "id": 14,
    "user_id": 2,
    "product": "guitar strings"
  },
  {
    "id": 15,
    "user_id": 999,
    "product": "book"
  }
]


output application/json
---
leftJoin(orders, users, (order) -> order.user_id, (user) -> user.id)