{"action":"created","issue":{"url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/34","labels_url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/34/comments","events_url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/34/events","html_url":"https://github.com/mickhansen/graphql-sequelize/issues/34","id":110316611,"number":34,"title":"root query field (viewer) as connection","user":{"login":"bsr203","id":1966521,"avatar_url":"https://avatars.githubusercontent.com/u/1966521?v=3","gravatar_id":"","url":"https://api.github.com/users/bsr203","html_url":"https://github.com/bsr203","followers_url":"https://api.github.com/users/bsr203/followers","following_url":"https://api.github.com/users/bsr203/following{/other_user}","gists_url":"https://api.github.com/users/bsr203/gists{/gist_id}","starred_url":"https://api.github.com/users/bsr203/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsr203/subscriptions","organizations_url":"https://api.github.com/users/bsr203/orgs","repos_url":"https://api.github.com/users/bsr203/repos","events_url":"https://api.github.com/users/bsr203/events{/privacy}","received_events_url":"https://api.github.com/users/bsr203/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2015-10-07T21:05:59Z","updated_at":"2015-10-08T15:03:06Z","closed_at":null,"body":"Hi,\r\n\r\nI am not much familiar `sequelize` and not sure how to define the schema to achieve what is described below.\r\n\r\nI have a `rootQuery`, where the fields are all connections. So, in [relay.test.js](https://github.com/mickhansen/graphql-sequelize/blob/master/test/relay.test.js#L162), it is like \r\n\r\n```\r\nschema = new GraphQLSchema({\r\n      query: new GraphQLObjectType({\r\n        name: 'RootQueryType',\r\n        fields: {\r\n          user: {\r\n           ......\r\n          },\r\n          users: {\r\n            type: userConnection.connectionType,\r\n            args: connectionArgs,\r\n            resolve: resolver(User)\r\n          },\r\n          project: {\r\n           ....\r\n          },\r\n          node: nodeField\r\n        }\r\n      })\r\n    });\r\n\r\n  });\r\n```\r\n\r\nso I modify from `List` to `Connection` to support pagination.\r\n\r\nbut the test fails\r\n\r\n```\r\nit.only('connections', function () {\r\n    var users = this.users;\r\n\r\n    return graphql(schema, `\r\n      {\r\n        users {\r\n          edges {\r\n            node {\r\n              name\r\n            }\r\n          }\r\n        }\r\n      }\r\n    `).then(function (result) {\r\n      console.log(result.data.users);\r\n\r\n      if (result.errors) throw new Error(result.errors[0].stack);\r\n\r\n      expect(result.data.users.edges.length).to.equal(users.length);\r\n      result.data.users.edges.forEach(function (edge) {\r\n        var user = edge.node;\r\n        expect(user.tasks.edges).to.have.length.above(0);\r\n      });\r\n\r\n\r\n    });\r\n  });\r\n```\r\n\r\nthe console log says \r\n\r\n```\r\n\r\n  relay\r\n{ edges: null }\r\n    1) connections\r\n\r\n\r\n  0 passing (229ms)\r\n  1 failing\r\n\r\n  1) relay connections:\r\n     TypeError: Cannot read property 'length' of null\r\n      at test/relay.test.js:482:37\r\n\r\n```\r\n\r\nWhat can I do to support the root query (typically `viewer`) has some fields which are connection?"},"comment":{"url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/comments/146572672","html_url":"https://github.com/mickhansen/graphql-sequelize/issues/34#issuecomment-146572672","issue_url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/34","id":146572672,"user":{"login":"mickhansen","id":699049,"avatar_url":"https://avatars.githubusercontent.com/u/699049?v=3","gravatar_id":"","url":"https://api.github.com/users/mickhansen","html_url":"https://github.com/mickhansen","followers_url":"https://api.github.com/users/mickhansen/followers","following_url":"https://api.github.com/users/mickhansen/following{/other_user}","gists_url":"https://api.github.com/users/mickhansen/gists{/gist_id}","starred_url":"https://api.github.com/users/mickhansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mickhansen/subscriptions","organizations_url":"https://api.github.com/users/mickhansen/orgs","repos_url":"https://api.github.com/users/mickhansen/repos","events_url":"https://api.github.com/users/mickhansen/events{/privacy}","received_events_url":"https://api.github.com/users/mickhansen/received_events","type":"User","site_admin":false},"created_at":"2015-10-08T15:03:06Z","updated_at":"2015-10-08T15:03:06Z","body":"@Aweary connections really only makes sense as an association does it not? Otherwise it's not really a connection."}}