Design

GraphQL Reference

Intro

This page will walk you through a series of GraphQL queries, each designed to demonstrate a particular feature of GraphQL. You’ll be querying the real schema used on gatsbyjs.org so feel free to experiment and poke around the innards of our site!

Basic query

Let’s start with the basics, pulling up the site title from your gatsby-config.js’s siteMetaData. Here the query is on the left and the results are on the right.

Try editing the query to include the description from siteMetadata. When typing in the query editor you can use Ctrl + Space to see autocomplete options and Ctrl + Enter to run the current query.

A longer query

Gatsby structures its content as collections of nodes, which are connected to each other with edges. In this query you ask for the total count of plugins in this Gatsby site, along with specific information about each one.

Try using the editor’s autocomplete (Ctrl + Space) to get extended details from the packageJson nodes.

Limit

There are several ways to reduce the number of results from a query. Here totalCount tells you there’s a few hundred results, but limit is used to show only the first two.

Filter

In this query filter and the ne (not equals) operator is used to show only results that have a title.

Gatsby relies on Sift to enable MongoDB-like query syntax for object filtering. This allows Gatsby to support operators like eq, ne, in, regex and querying nested fields through the __ connector