Hi All,
Wondering if this is a bug or something I've missed while updating our neo4j-graphql API from V3 to V4.
Given the following type defs (cut-down to relevant properties):
type Brand {
services: [Service!]! @relationship(type: "HAS_SERVICE", direction: OUT)
}
type Collection {
services: [Service!]! @relationship(type: "HAS_SERVICE", direction: OUT)
}
type Service {
collection: Collection @relationship(type: "HAS_SERVICE", direction: IN)
}
If I run a query as follows (to find Services that aren't in a Collection):
query ExampleQuery {
brands {
services(where: { collectionAggregate: { count: 0 } }) {
collectionAggregate {
count
}
}
}
}
In V3 I got the following result (as expected):
{
data: {
"brands": [
{
"services": [
{
"collectionAggregate": {
"count": 0
}
}
]
}
]
}
}
But now, in V4, I get this result:
{
data: {
"brands": [
{
"services": [
{
"collectionAggregate": {
"count": 0
}
},
{
"collectionAggregate": {
"count": 1
}
}
]
}
]
}
}
So, in V4, the aggregate filter is not being respected. However, if I query with Services at the top level (as opposed to Brands), the aggregate filter works correctly, leading me to believe that the issue is only effecting aggregate filters when nested.
i.e. the following query, in V4, with the Services at top level, returns only Services that are not related to a Collection (as expected):
query ExampleQuery {
services(where: { collectionAggregate: { count: 0 } }) {
collectionAggregate {
count
}
}
}
I haven't found anything to suggest this is a known bug, but it's clearly a breaking change that as far as I can tell was not listed in the V3 to V4 Migration Guide.
The only relevant mention of aggregates in the Migration Guide was: " Aggregation operations are no longer generated by default. They can be enabled case by case using the directives @query and @relationship.", but it seems I can still access aggregate data without this flag (I have also tried adding the flag to relevant relationships but it doesn't seem to make any difference).
Has anyone else experienced this issue or know of any solution?
Thanks.