For a given user I want to get all the runs that
- satisfy some conditions
- get only runs from projects that the user has access to
In Users table, every user has a list of project ids while in Runs table, every run has a project id. The following is a query that works. Can it be optimized using concatMap?
r.table('users')
.inner_join(
r.table('runs').filter( lambda var_6: (<some_condns>),
lambda user, run: user['projects'].contains(run['project_id'])
)
.filter(lambda l: l['left']['id'] == '<user_id>').without('left')
I think equiJoin may not work because I am looking for item in a list as apposed to equality.