0

I am trying to query a Table with a Hash and Range key for all Items whose Range match a value in an array. I'm using the aws-sdk npm module. When I run the below scan I get a ValidationException.

client.scan({
    TableName: "MyTable",
    ScanFilter: {
        HashID: {
            AttributeValueList: [ { "S": "hash" } ],
            ComparisonOperator: "EQ",
        },
        RangeID: {
            AttributeValueList: [ {"SS": ["a", "b"]} ],
            ComparisonOperator: "IN"
        },
    },
}

Error response:

{ [ValidationException: The attempted filter operation is not supported for the provided type]
message: 'The attempted filter operation is not supported for the provided type',
code: 'ValidationException',
name: 'ValidationException',
statusCode: 400,
retryable: false }

How do I do this query?

1 Answer 1

1

From the API:

IN : checks for exact matches.

AttributeValueList can contain more than one AttributeValue of type String, Number, or Binary (not a set). The target attribute of the comparison must be of the same type and exact value to match. A String never matches a String set.

This means you can't use a string set (SS). You will probably need to pass the AttributeValueList a few AttributeValue objects with type S.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.