Hi Guys,
   Need help, how can I join  and match 2 array fields values inside LET Clause.
// here is my query
SELECT meta(`users`).id, territories, locations FROM `bucket` AS `users` LET territories = ( SELECT META().id, name FROM `bucket` USE KEYS `users`.territories ), locations = ( SELECT META(`location`).id, `location`.name, `location`.territory FROM `bucket` `location` WHERE `location`.type = 'location' ) WHERE META().id = 'userId::9b8c'
// query result of the above query:
[
   {
      "id": "userId::9b8c",
      "territories": [
          {
            "id": "territory::0021",
            "name": “T0021"
          },
          {
            "id": "territory::0012",
            "name": “T0012"
          }
      ]
   }
]
// the docs want to be join and match.
"locations": [
      {
        "id": "location::02”,
        "name": "Location 25”,
        "territory": "territory::0021"
      },
      {
        "id": "location::09”,
        "name": "Location 46”,
        "territory": "territory::0058”
      },
      {
        "id": "location::56”,
        "name": “Location 42”,
        "territory": "territory::0012"
      }
]
EXPECTED OUTPUT:
[
   {
      "id": "userId::9b8c",
      "territories": [
          {
            "id": "territory::0021",
            "name": “T0021"
          },
          {
            "id": "territory::0012",
            "name": “T0012"
          }
      ],
      "locations": [
          {
            "id": "location::02”,
            "name": "Location 25”,
            "territory": "territory::0021"
          },
         {
            "id": "location::56”,
            "name": “Location 42”,
            "territory": "territory::0012"
         }
       ]
   }
]
Thanks guys, appreciated.
