Closed renatomattos2912 closed 6 years ago
let's say you have a collection named posts
then you can do a query like this:
allPosts {
_id,
title
content
}
Greets Artur
Is possible to query nested collection?
I tries this bellow:
query { allCategories { _id, Subcategories { Name } } }
but i'm getting this error bellow:
{ "errors": [ { "message": "Cannot query field \"Subcategories\" on type \"Categories\".", "category": "graphql", "locations": [ { "line": 4, "column": 5 } ] } ] }
But in REST the collection Categories have a nestes Subcategories, so i dont know why this graphql query is not working.
Ps: When i query only for fileds of the root collection, it works.
please update to the latest codebase then this should work:
query {
allCategories(populate:1) {
_id,
Subcategories {
Name
}
}
}
Ok, great. Thanks for your help.
Hi, i'm testing this module and i can query in my collections just like i do in traditional REST cockpit API, but i want to use some cool graphql features like query in collection and get only the fields that i need, how can i do this with this module?