Skip to content

Cannot use Between Operator with keyConditions #101

@farhan2986

Description

@farhan2986

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions