Say I have a one-to-many relationship between Blogs
and Comments
.
In squidex, I modelled this by defining a Blogs
schema that have a “comments” field, of reference type, to Comments
schema.
What I can do now, is issue GraqhQL queries like this:
(query simplified for readability)
query {
queryBlogsContents(top: 5, skip: 10, orderby: "title desc", filter: "contains(status, 'PUBLISHED')") {
title
status
comments {
message
date
}
}
}
And this will return all comments of selected blogs.
But I would like to be able to query in the following way:
query {
queryBlogsContents(top: 5, skip: 10, orderby: "title desc", filter: "contains(status, 'PUBLISHED')") {
title
status
comments(top: 5, skip: 10, orderby: "date desc", filter: "contains(message, 'squidex')") { // Note that the comments field now accepts arguments for paging/filtering..
message
date
}
}
}
So that I get only a subset of available comments, based on provided arguments.
In other words, I am proposing that reference fields can accept arguments (search, top, skip, orderby
and filter
) much like top level queries can.
I hope others will find this as useful as we do, and that it is not too difficult to implement.
Thank you