Skip to main content
Every table in the Data Model generates a set of queries on the GraphQL schema. This page covers the patterns you’ll reach for most often. The examples assume a students table with fields like firstName, email, age, isActive, createdAt, and a city relationship.

Single record

Fetch one record by its primary key.
Any field marked Unique in the Data Model can also be used as a query argument.

Record list

The list query wraps results in a Connection type with two top-level fields: items (the array of records) and count (the number of records returned).

Filtered list

The filter argument takes a structured input that mirrors the field types on the table. Each field exposes a set of operators (equals, gt, contains, starts_with, etc.).
For the full operator reference and the relational filter quantifiers (some, every, none), see Standard operations.

Combining conditions with AND / OR

Use the AND and OR keys to compose multiple conditions on the same query.

Paginated list

first controls the page size; skip controls the offset.
For cursor-stable pagination, use pageInfo.hasNextPage and pageInfo.hasPreviousPage on the Connection wrapper:

Sorted list

Pass an array of field enums to sort. Append _DESC for descending; the bare enum sorts ascending.
The object-style alternative is orderBy, which accepts ASC or DESC per field:
For sorting by a computed aggregate value, use aggregateSort — see Grouping and aggregation.

Combining arguments

filter, first, skip, sort, and orderBy all stack on the same query.

Combining queries

A single GraphQL request can run multiple top-level queries. They execute in parallel and return as one response.
If you need the same query run twice with different arguments in one request, use aliases:

Aggregation

Every list query exposes a built-in count field on the Connection wrapper. No extra arguments needed.
For sums, averages, and other aggregate functions, see Grouping and aggregation below.

Grouping and aggregation

Four arguments work together to compute analytics in a single query:

Group by a field

The enum value is the camelCase field name converted to UPPERCASE: isActiveISACTIVE, paymentMethodPAYMENTMETHOD.

Compute aggregates per group

aggregateBy takes a list of { function, field, alias } entries. The result lands in the aggregates array, parallel to items.

Filter groups with having

having references the alias defined in aggregateBy. Operators are EQUALS, NOT_EQUALS, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL.

Sort by aggregate

All four together

filter runs before grouping (SQL WHERE); having runs after (SQL HAVING).

Permissions

Every query is filtered by the per-role permissions in Role-Based Access. Records and fields a role isn’t allowed to read are silently omitted from the response — they don’t trigger errors.

FAQ

count reflects the total number of matching records (subject to permissions), while items reflects only the current page. With first: 10, items.length is at most 10 but count may be much larger.
They do the same thing in different syntaxes. sort takes an array of enum values ([CREATEDAT, FIRSTNAME_DESC]); orderBy takes an object ({ createdAt: ASC, firstName: DESC }). Pick whichever reads better in your query.
The Explorer accepts large first values, but very large pages are slow. Use pagination with reasonable page sizes (20–100) and combine with sorting to keep results stable across requests.
Yes — switch environments in the Backend Console, or call the environment-specific endpoint from outside the Explorer. See Environments.