aws appsync combine filter operators
See original GitHub issueIs it possible in AWS appsync / amplify to combine filter operators, like:
` const filterInput = {
or:[
{
and: [
{createdById: { eq: userID }},
{chatWithId: { eq: chatWithUser.id }}
]
},
{
and: [
{createdById: { eq: chatWithUser.id }},
{chatWithId: { eq: userID }}
]
}
]
}
`
Because for me this is not filtering / working as expected.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top Results From Across the Web
aws appsync combine filter operators - Stack Overflow
What I try to achieve is combine operator filters. So I want to filter on the firsts AND - OR - on the...
Read more >Enhanced subscription filtering - AWS AppSync
Learn about enhanced subscription filtering in AWS AppSync. ... API subscription resolvers by using filters that support additional logical operators.
Read more >API (GraphQL) - Fetch data - JavaScript - AWS Amplify Docs
Compound Filters. You can combine filters with and , or , and not boolean logic. Observe, in the autogenerated schema above, ...
Read more >AppSync Insights Part 2: Implementing a reusable and generic ...
In our solution a query with a filter looks like this: ... we again combine them with the AND operator: in the example...
Read more >Filters, IN comparison operator, toDynamoDBFilterExpression()
That function transforms the filter input according to the documentation (https://docs.aws.amazon.com/appsync/latest/devguide/resolver-util-reference.html).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It works ! For those still trying, here is a working example :
query list { list (filter :{ and: [ { available: {eq: true}}, { id: {eq: “XXXXX”}}, { or: [ {promo: {eq: true}}, {price: {between : [40,45] }} ] } ]} ) { items { id price } } }
When using the AppSync console, using the Query builder doesn’t generate a useable code:
For example, clicking the ‘or’ option and then providing a value ‘myName’ for the ‘name’ field generates this:
It takes a bit of working out from here that you should wrap the
{name: {eq: "myName"}
section in square [] brackets. It would be useful if the [] were generated and with new lines/indentation to make it more obvious what the intention is.