-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
how to achieve nested filters query? #141
Comments
Currently, this isn't supported in Dynamooose. While DynamoDB does support this logic, it requires the use of a FilterExpression: Dynamoose uses the legacy ScanFilter which doesn't support nesting: This is something I would like to implement int he future, but haven't had the time to do. See #65 |
thanks @brandongoode |
Hi all I think it would be a nice idea for now that dynamoose allows raw filter in scan i.e.
I would like to try to fork one to see how it goes. Regards Hans |
@lrcry That great. I was thinking about this some over the past week and wanted to share my thoughts. I don't think the Something like this: GameResults
.scan()
.filterExpression('#s > :score')
.expressionAttributeValues({ score : 100 })
.expressionAttributeNames({ s : 'score'}) or GameResults
.scan({
filterExpression: '#s > :score',
expressionAttributeValues: { score : 100 },
expressionAttributeNames: { s : 'score'}
}) |
@brandongoode This syntax you suggested seems similar to this. BTW I got the one I raised implemented just now. Just wondering if it is enough for now as I can see that quite a few people need the nested scan. |
Yes, it is very similar. A few minor differences around name and value definition. My goal is to have it align the current implementation of conditions (really just filter expressions) in I try to make sure all query and scans can be build using and object or the helper function. Please go ahead and submit the PR for review. The functions can be added later. |
@lrcry I'm looking forward to this... thanks for the effort! |
@lrcry Do you know when you plan to have this PR ready. I'm planning to release 0.8 sometime over the next week. I would like to include this in that release if you think it will be ready. |
@brandongoode @jderose9 I'm still tackling with some problem over there. Trying to get it in v0.8. Thanks |
I've opened a PR here. Please feel free to tell me your thoughts. Cheers ;) |
Closes by #158 |
Friends.scan({
or: [
{and: [{userRef: {eq: {id: param.user}}, friend: {eq: {id: param.friend}}}]},
{and:[{userRef: {eq: {id: param.friend}}, friend: {eq: {id: param.user}}}]}
]
}
Example.
The text was updated successfully, but these errors were encountered: