'Gatsby graphql filter statement is not working as expected
I have a query (based on JSON input) defined in Gatsbys GraphiQL IDE which looks this trying to return only those items which have a value of less than 10 in playtime_forever:
allContentJson(
filter: {response: {games: {elemMatch: {playtime_forever: {lt: 10}}}}}
) {
edges {
node {
response {
games {
playtime_forever
}
}
}
}
}
}
However running this query I also receive those which are greater than 10:
{
"data": {
"allContentJson": {
"edges": [
{
"node": {
"response": {
"games": [
{
"playtime_forever": 0
},
{
"playtime_forever": 93
},
{
"playtime_forever": 5302
}
]
},
}
}
]
}
},
"extensions": {}
}
I have this feeling this is how elemMatch is supposed to work or is there any other approach (possibly by defining types?)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
