Join with keys with prefix

n1ql

#1

Hi all,

I have these documents on a same bucket, I would like to join them using N1ql.
The prefix for the keys change according to the application name.

document Key is “InventoryApplication4567”

{
   email: "test@email.com",
   countryId: "1234",
   type: "customer"
}

document Key is “InventoryApplication1234”

{
   name: "United States",
   type: "country"
}

Can somebody please help me make a JOIN query using n1ql for this case?


#2
SELECT t.*, c.name
FROM default AS t
JOIN default AS c
ON KEYS "InventoryApplication"||t.countryId
WHERE .....;

In 5.5 you can use ANSI JOINS https://blog.couchbase.com/ansi-join-support-n1ql/