How would I use my query result as a condition inside another query?
Here is example documents
[student document (student_999)]
{ firstName: 'Allen', lastName: 'Smith', classId: 'class_123' }
[books document]
{ topic: 'math', classId: 'class_123'}
{ topic: 'english', classId: 'class_123'}
{ topic: 'german', classId: 'class_000'}
So the idea is that, given a known student id, I’ll need to query books that used by the student in a class.
SELECT a.classId FROM bucket a WHERE meta(a).id=='student_999'
–> this will return the classId,
SELECT a.* FROM bucket a WHERE a.type=="books" AND a.classId =="class_123"
–> this returns the books with the classId above.
How would I join these two query into one?