Salta ai contenuti

Query Elenco Record

Puoi interrogare un elenco di record. Negli esempi seguenti, abbiamo una tabella chiamata students, che contiene campi e relazioni come firstName, email.

Interroga l’elenco dei record da una singola tabella. Nota la chiave items che indica che verrà restituito un array di risultati.

Richiesta

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

Risposta

{
"data": {
"students": {
"count": 3,
"items": [
{
"id": "287cff0a-345b-4cca-9e9a-75a2161238fd",
"firstName": "James",
"email": "james.smith@example.com"
},
{
"id": "97fb89ac-e0ad-44f5-b671-24a1b751287c",
"firstName": "John",
"email": "john.williams@example.com"
},
{
"id": "429cf99f-4481-49c4-adb4-605731b20eb2",
"firstName": "Mary",
"email": "mary.brown@example.com"
}
]
}
}
}