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 aDocumentation Index
Fetch the complete documentation index at: https://archie.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
students table with fields like firstName, email, age, isActive, createdAt, and a city relationship.
Single record
Fetch one record by its primary key.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
Thefilter 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.).
some, every, none), see Standard operations.
Combining conditions with AND / OR
Use theAND and OR keys to compose multiple conditions on the same query.
Paginated list
first controls the page size; skip controls the offset.
pageInfo.hasNextPage and pageInfo.hasPreviousPage on the Connection wrapper:
Sorted list
Pass an array of field enums tosort. Append _DESC for descending; the bare enum sorts ascending.
orderBy, which accepts ASC or DESC per field:
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.Aggregation
Every list query exposes a built-incount field on the Connection wrapper. No extra arguments needed.
Grouping and aggregation
Four arguments work together to compute analytics in a single query:| Argument | Purpose |
|---|---|
groupBy | Fields to group by (one row per distinct combination of values). |
aggregateBy | Aggregate functions to compute on each group. |
having | Filter groups by aggregate results (SQL HAVING equivalent). |
aggregateSort | Sort groups by aggregate values. |
Group by a field
isActive → ISACTIVE, paymentMethod → PAYMENTMETHOD.
Compute aggregates per group
aggregateBy takes a list of { function, field, alias } entries. The result lands in the aggregates array, parallel to items.
| Function | Field required? |
|---|---|
COUNT | No (counts all rows when omitted) |
SUM | Yes |
AVG | Yes |
MIN | Yes |
MAX | Yes |
COUNT_DISTINCT | Yes |
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
Why is `count` separate from the array length?
Why is `count` separate from the array length?
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.What's the difference between `sort` and `orderBy`?
What's the difference between `sort` and `orderBy`?
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.How do I filter by a related table's field?
How do I filter by a related table's field?
What's the largest page I can request?
What's the largest page I can request?
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.Can I run a query against a non-default environment?
Can I run a query against a non-default environment?
Yes — switch environments in the Backend Console, or call the environment-specific endpoint from outside the Explorer. See Environments.