Aller au contenu

Simple Aggregation

Ce contenu n’est pas encore disponible dans votre langue.

You can fetch aggregations on nodes using an aggregation query. Currently the available aggregation function is count.

In the following examples, we have a table called students, which contains fields and relations like firstName, email, age.

Request

query MyQuery1 {
students {
count
items {
id
firstName
}
}
}

Response

{
"data": {
"students": {
"count": 7,
"items": [
{
"id": "287cff0a-345b-4cca-9e9a-75a2161238fd",
"firstName": "James"
},
{
"id": "97fb89ac-e0ad-44f5-b671-24a1b751287c",
"firstName": "John"
},
{
"id": "429cf99f-4481-49c4-adb4-605731b20eb2",
"firstName": "Mary"
},
{
"id": "e25c4955-7ea7-4a83-a3de-d4c7427cc9fa",
"firstName": "Robert"
},
{
"id": "f0852941-f212-4af0-a583-49ccc10ab42b",
"firstName": "Jennifer"
},
{
"id": "13fcb5bf-a8a4-4e55-860f-74f425944ec0",
"firstName": "Mary"
},
{
"id": "f26032aa-0a4f-4a72-80a7-a66968065a84",
"firstName": "Elizabeth"
}
]
}
}
}