Type

As the name says Type is the type of Object/Field we're creating or accessing.

If you have used databases you must already be familiar with this as we have different types for fields in Databases like String, Integer, Float, Number, Varchar, Text, etc.

It's just like that, Here we have different types which we can associate with fields.

In GraphQL We have to associate every field with a Type.

The most common ones are:

GraphQLObjectType This is used for defining objects, Each field in the object will have its own type GraphQLID For fields that represent ID of a particular record., Ex: MongoDB _id field GraphQLInt This type is used when we expect the field value to be a number. GraphQLString This is used when the field value is expected to be String/Text. GraphQLFloat This is used for floats GraphQLList This is used when we expect the field value to be an Array. GraphQLNonNull This can be used with any Field Type, We use this when we want to mark a field as Required .

There are many more field Types, You can find the full list here http://graphql.org/learn/schema/ .

Along with the existing Types, We can very easily create our own Field types, This can be useful for Email, URL, Date, Phone, Address, etc fields.