Skip to content
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

Cannot use Between Operator with keyConditions #101

Open
farhan2986 opened this issue Mar 19, 2018 · 1 comment
Open

Cannot use Between Operator with keyConditions #101

farhan2986 opened this issue Mar 19, 2018 · 1 comment

Comments

@farhan2986
Copy link

farhan2986 commented Mar 19, 2018

Cannot use between operator with key conditions due to following code.
https://github.com/victorquinn/dynasty/blob/master/src/lib/aws-translators.coffee
line 14 - target[filter.column].AttributeValueList[0][filter.type || 'S'] = filter.value

Between operator should be like this.
"ComparisonOperator":"BETWEEN", "AttributeValueList": [ {"S": "A"}, {"S": "M"} ]

@victorquinn can we fix this by checking if filter.op Between at line 14 or any quick workaround?

current {keyConditions: [{column: 'createdDate', op: 'BETWEEN', value: '4'}]}
suggestion {keyConditions: [{column: 'createdDate', op: 'BETWEEN', value: ['4', '6']}]}
And then update line 14 accordingly. Will this work?

filterValues = _.isArray(filter.value)?filter.value:[filter.value]
filterValues.forEach((value, key) => target[filter.column].AttributeValueList[key][filter.type || 'S'] = value)

@oskee121
Copy link

oskee121 commented Nov 14, 2018

I have created a PR to solve this issue. (#116)

Note: this change follow your suggestion

suggestion {keyConditions: [{column: 'createdDate', op: 'BETWEEN', type: 'S', value: ['4', '6']}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants