I am using hot chocolate filtering V13 and not getting desired result. i.e., I have a JSON
as following:
{
"id": "b3d7768e-7a22-4109-9511-cdd17585267b",
"createdDateTime": "2023-06-01T21:02:34.4800722+00:00",
"earliestPaymentDate": "2023-05-31T07:00:00+00:00",
"itemNumber": "abc123456",
"lineItems": [
{
"dueDate": "2023-07-01T06:59:59+00:00",
"eventId": null,
"itemState": "Mismatched",
"itemUpdateDateTime": "2023-06-01T21:07:26.284906+00:00",
"type": "Part"
},
{
"dueDate": "2023-07-01T06:59:59+00:00",
"eventId": null,
"itemState": "Mismatched",
"itemUpdateDateTime": "2023-06-01T21:07:26.2849904+00:00",
"type": null
}
]
}
My return object look like this where matchedEntries
and mismatchedEntries
are simply filter on itemState
property.
type EventDto {
id: String
itemNumber: String
matchedEntries: [ItemDto]
mismatchedEntries: [ItemDto]
}
When I write following query with filtering, then I expect null
or empty
result because there is and
condition with 2 search criteria which does not exist but it still returns 2 records.
query {
itemDetailsByItemNumber(
itemNumber: ["abc123456"],
where: {
and: [
{ matchedEntries: { all: { itemState: { contains: "Mismatched" } } } },
{ matchedEntries: { all: { type: { contains: "Cars" } } } }
]
}
) {
id
}
}
Questions:
- Is my query wrong?
- Do filtering works differently then what I am expecting?