Hello,
I am facing an issue while querying my product data using GraphQL in relation to filtered aggregation counts.
interface product {
id: ID!
name: String! @id @search(by: [regexp])
sku: String @search(by: [regexp])
manufacturer: manufacturer!
}
type manufacturer {
name: String! @id @search(by: [regexp])
products: [product] @hasInverse(field: manufacturer)
}
type device implements product {
lockStatus: lockStatus! @search
}
I want to get details using graphql query as below.
query {
querydevice(filter: {lockStatus: { in: [LOCKED] }}) {
id
name
sku
manufacturer() {
name
productsAggregate {
count
}
}
}
}
When I pass a filter in the querydevice
query, the productsAggregate
count returns incorrect data (it seems to be aggregating from all products rather than just the filtered ones).
Additionally, I want to get the count of all devices with lockStatus = "LOCKED"
(which is an enum) in the same query. Could you please guide me on how to properly handle this and get the expected results?