title: GraphQL: How to make nested queries?
body: <p>I have defined two independent queries called <em>nextgamedaylf1</em> and <em>teamclub</em>. Both work fine isolated, but I want to include teamclub query inside of nextgamedaylf1 query.</p>
  
  <p>To do that, I have created a field in the schema of nextgamedaylf1 called home_team which is from type teamclub.</p>
  
  <pre><code>import { 
      GraphQLObjectType,
      GraphQLNonNull,
      GraphQLID,
      GraphQLInt,
      GraphQLBoolean
  } from "graphql";
  import {DateTime} from "../scalar/dateTime";
  import {TeamClub} from "./teamclub.schema";
  
  const NextGameday = new GraphQLObjectType({
      name: "NextGameday",
      description: "List of games of next gameday",
      fields: () =&gt; {
          return {
              id: {
                  type: new GraphQLNonNull(GraphQLID),
                  description: "ID of NextGameday",
                  resolve(ng){
                      return ng.id
                  }                
              },
              id_competition: {
                  type: new GraphQLNonNull(GraphQLInt),
                  description: "ID of competition",
                  resolve(ng){
                      return ng.id_competition
                  }
              },
              id_home_team: {
                  type: new GraphQLNonNull(GraphQLInt),
                  description: "ID of home team",
                  resolve(ng){
                      return ng.id_home_team
                  }
              },            
              home_team: {
                  type: TeamClub
              },
              id_away_team: {
                  type: new GraphQLNonNull(GraphQLInt),
                  description: "ID of away team",
                  resolve(ng){
                      return ng.id_away_team
                  }
              },
              date: {
                  type: new GraphQLNonNull(DateTime),
                  description: "Date time of the game",
                  resolve(ng){
                      return ng.date
                  }
              },
              played: {
                  type: new GraphQLNonNull(GraphQLBoolean),
                  description: "Game played. 0: Game NOT played. 1: Game played.",
                  resolve(ng){
                      return ng.played
                  }
              }
          }
      }
  });
  
  module.exports.NextGameday = NextGameday;
  </code></pre>
  
  <p>And when I try to get the data from GraphiQL I've got this error:</p>
  
  <p><img src="https://i.stack.imgur.com/X4roe.png" alt=""></p>
  
  <p>So, how can I make a nested query with GraphQL? </p>
  
  <p>Schema for teamclub:</p>
  
  <pre><code>import { 
      GraphQLObjectType,
      GraphQLNonNull,
      GraphQLID,
      GraphQLInt,
      GraphQLString
  } from "graphql";
  import {DateTime} from "../scalar/dateTime";
  
  const TeamClub = new GraphQLObjectType({
      name: "TeamClub",
      description: "Data from a team which belongs to a club",
      fields: () =&gt; {
          return {
              id: {
                  type: new GraphQLNonNull(GraphQLID),
                  description: "ID of team club",
                  resolve(tc){
                      return tc.id
                  },       
              },
              id_league: {
                  type: new GraphQLNonNull(GraphQLInt),
                  description: "ID of league",
                  resolve(tc){
                      return tc.id_league
                  }
              },
              id_season: {
                  type: new GraphQLNonNull(GraphQLInt),
                  description: "ID of season",
                  resolve(tc){
                      return tc.id_season
                  }
              },
              id_club: {
                  type: new GraphQLNonNull(GraphQLInt),
                  description: "ID of Club",
                  resolve(tc){
                      return tc.id_club
                  }
              },
              id_team_feb: {
                  type: new GraphQLNonNull(GraphQLInt),
                  description: "ID of FEB",
                  resolve(tc){
                      return tc.id_team_feb
                  }
              },
              logo: {
                  type: GraphQLString,
                  description: "url to the logo",
                  resolve(tc){
                      return tc.logo
                  }
              },
              name: {
                  type: new GraphQLNonNull(GraphQLString),
                  description: "Name of the team which belongs to a club",
                  resolve(tc){
                      return tc.name
                  }
              },
              abrev: {
                  type: GraphQLString,
                  description: "Abreviature of the name of the team",
                  resolve(tc){
                      return tc.abrev
                  }
              },
              url_name: {
                  type: new GraphQLNonNull(GraphQLString),
                  description: "Name for the url of the team",
                  resolve(tc){
                      return tc.url_name
                  }
              },
              r_name: {
                  type: GraphQLString,
                  description: "Name of the team for R graphics",
                  resolve(tc){
                      return tc.r_name
                  }
              },
              date_start: {
                  type: new GraphQLNonNull(DateTime),
                  description: "Date of insert in database",
                  resolve(tc){
                      return tc.date_start
                  }
              }
          }
      }
  });
  
  module.exports.TeamClub = TeamClub;
  </code></pre>