j.query

Use the j.query function to run a specification and retrieve the results.

const projectsForUser = model.given(User).match((user, facts) =>
  facts.ofType(Project)
    .join(project => project.owner, user)
    .select(project => ({
      hash: j.hash(project),
      identifier: project.identifier
    })
  )
);

const projects = await j.query(projectsForUser, user);

// projects = [{
//   hash: "..."
//   identifier: "..."
// }, ...]

This asynchronous function returns an array of results.

Continue With

j.watch

Jinaga is a product of Jinaga LLC.

Michael L Perry, President