-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtering on Contains in Array - JSON content #4799
Comments
+1
because when exploring QraphiQL it looks like that is what is needed but it always returns null. Gatsby version: 1.9.233 |
Just stumbled upon this. For my case, this was the syntax that I expected to work, similar to @MarcCoet
But seems like this structure is not supported. Will have to pull out data without filtering and filter it in javascript, I guess. |
Facing same problem, |
I can't seem to filter on an abject nested inside an array, either that or the syntax is too complicated, getting null as well |
There is a bug in how schema is constructed for array of objects - inside So in example from this issue: filter: { language: { eq: $language }, category: { in: [{slug: {eq: $slug} }] } } } schema shouldn't add that filter: { language: { eq: $language }, category: { in: [{slug: $slug }] } } } If anyone is interested in fixing this - https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/schema/infer-graphql-input-fields.js and https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/schema/infer-graphql-input-fields-from-fields.js is where schema is constructed for inputs |
Is this bug affecting v2? I'd look into it if it's affecting both versions |
This is affecting both v1 and v2 (there were no schema related changes in v2) |
I also ran into this bug, but I found this PR: #6315 which appears to fix it in gatsby@2.0.0-beta.22. I'm now able to do queries with elemMatch rather than in, E.g.:
|
Nevermind, I'd downgraded my version of gatsby and forgotten. It is definitely working. |
This was fixed in gatsby v2 by, so I'm closing this issue |
Description
I have tags arrays in my content, and I want to be able to fetch by those tags.
Steps to reproduce
Use JSON content like this:
Then try to fetch for content which contains tag 'a' with this query:
Expected result
I would expect this to work as per this example and this issue:
Example:
gatsby/examples/using-remark/src/templates/template-tag-page.js
Line 39 in 52e36b9
Issue: #1645
Actual result
The only way I've found to get the query to run is this:
But I always end up with
null
as the result.Environment
npm list gatsby
):gatsby@1.9.243
gatsby --version
): Not installed (I usepackage.json
commands)File contents (if changed):
(I'll provide an example project which reproduces this if needed.)
The text was updated successfully, but these errors were encountered: