N1QL Multiple joins

Hi Guys!!!

Aloha!

I have 3 document type in one bucket and want to join them

Here is my document
{
type: student,
studentId:00001,
name: John Doe ,
}

{
type: grades,
studentId:00001,
grade: 80
}

{
type:payment,
studentId:00001,
amount: $80000
}

How can I join the three documents using studentId ?

Thanks in advance!!!

<3 <3 <3

If you are using 5.5 you can use ANSI JOIN
Otherwise can you update post with document key, so that will know if any relation is present or not.

Also checkout N1QL for merge 3 records