Same setup as #4951 (and possibly related).
This query groups books by genre and displays their titles:
{
Book(groupBy: [genre]) {
genre
GROUP {
title
}
}
}
{
"data": {
"Book": [
{
"GROUP": [
{
"title": "Les Misérables"
},
{
"title": "Infinite Jest"
},
{
"title": "1984"
},
{
"title": "Lord of the Flies"
},
{
"title": "Girl with Curious Hair"
}
],
"genre": "Fiction"
},
{
"GROUP": [
{
"title": "Consider the Lobster and Other Essays"
}
],
"genre": "Nonfiction"
},
{
"GROUP": [
{
"title": "Down and Out in Paris and London"
}
],
"genre": "Memoir"
}
]
}
}
However, remove the genre field from the top return, and all books get clumped into a single group:
{
Book(groupBy: [genre]) {
# genre
GROUP {
title
}
}
}
{
"data": {
"Book": [
{
"GROUP": [
{
"title": "Les Misérables"
},
{
"title": "Infinite Jest"
},
{
"title": "Consider the Lobster and Other Essays"
},
{
"title": "Down and Out in Paris and London"
},
{
"title": "1984"
},
{
"title": "Lord of the Flies"
},
{
"title": "Girl with Curious Hair"
}
]
}
]
}
}
Same setup as #4951 (and possibly related).
This query groups books by genre and displays their titles:
{ Book(groupBy: [genre]) { genre GROUP { title } } }{ "data": { "Book": [ { "GROUP": [ { "title": "Les Misérables" }, { "title": "Infinite Jest" }, { "title": "1984" }, { "title": "Lord of the Flies" }, { "title": "Girl with Curious Hair" } ], "genre": "Fiction" }, { "GROUP": [ { "title": "Consider the Lobster and Other Essays" } ], "genre": "Nonfiction" }, { "GROUP": [ { "title": "Down and Out in Paris and London" } ], "genre": "Memoir" } ] } }However, remove the
genrefield from the top return, and all books get clumped into a single group:{ Book(groupBy: [genre]) { # genre GROUP { title } } }{ "data": { "Book": [ { "GROUP": [ { "title": "Les Misérables" }, { "title": "Infinite Jest" }, { "title": "Consider the Lobster and Other Essays" }, { "title": "Down and Out in Paris and London" }, { "title": "1984" }, { "title": "Lord of the Flies" }, { "title": "Girl with Curious Hair" } ] } ] } }