Plural root fields accept four arguments: filter
, sort
, skip
, and limit
. The filter
argument permits filtering based on node field values, and sort
reorders the result. Meanwhile, the skip
and limit
arguments offset the result by the number of skip
nodes and restrict it to the number of limit
items. In GraphQL, plural root fields return a Connection
type for the given type name (e.g., BlogArticleConnection
for allBlogArticle
).
Here is an example of a plural root field query, which retrieves multiple nodes of type blogArticle
with two arguments that filter and sort the incoming data:
{
allBlogArticle(
filter: { date: { lt: "2020-01-01" } }
sort: { fields: [date], order: ASC }
) {
nodes {
id
}
}
}
Leave a Reply