Skip to content

Instantly share code, notes, and snippets.

@koskimas
Created November 16, 2019 18:16
Show Gist options
  • Select an option

  • Save koskimas/b880a4164e79e079bc898334a4c1f04f to your computer and use it in GitHub Desktop.

Select an option

Save koskimas/b880a4164e79e079bc898334a4c1f04f to your computer and use it in GitHub Desktop.
// Note that the following query isn't executed! There's no `await`.
const jennifers = Actor.query().where('firstName', 'Jennifer')
// This is the only query that gets executed. `jennifers` query is built into
// the SQL as a subquery.
const movies = await Actor.relatedQuery('movies')
.for(jennifers)
.where('genre', 'action')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment