GraphQL Cookbook

Finding objects

10min

Finding objects through the Parse GraphQL API

Problem

You want to find objects from your database through the Parse GraphQL API.

Solution

Using the parse GraphQL, there are two different ways to find objects from your database:

  • Using generic query - this is the query that you can use to find objects of any class.
  • Using class query - this is the recommended query that you should use to find objects of a specific class.

Version Information

Depending on the version of Parse you choose to run, the GraphQL queries, mutations and results will be slightly different. Please choose the correct example along with the Parse version you are running.

Using generic query

When you use the find generic query, Parse Server behaves like a schemaless database. It means that you do not need to specify which object’s fields you want to retrieve. You just need to send the object’s className, and Parse Server will return all fields of the found objects.

Therefore, the objects’ find generic query is the query that you can use for finding objects of any class. If you want to find objects of a specific class, we recommend using the class query.

This example will only work if you use a className with existing object. You can create an object using the creating an object recipe.

Parse Server 3.8.0

Request
Response


Example 3.9.0 and later:

Parse 3.9.0 and later does not have the generic methods GET and FIND. You must use the specific methods below to retrieve objects.

Using class query

Once you have already created your object’s class in your application’s schema (for instance, using the creating an object recipe), Parse Server instantly adds to your GraphQL API a new find<ClassName> query to find objects of this class.

Therefore, the object’s class query is the recommended method for finding objects of a specific class. Since this query knows your class’ data, it will automatically make available for you additional features like code auto-complete and validation.

This example will only work if you use a class' query of existing object. You can create an object using the creating an object recipe.

Parse Server 3.10.0 and later

Request
Response


Older Parse Server Versions