Reputation: 2273
Working with Query API from DynamoDB. Entities table has hash-and-range primary key. Range column is of String type. While doing BETWEEN query on range key I got strange results:
And documentation is not very clear:
BETWEEN : Greater than, or equal to, the first value and less than, or equal to, the second value. For BETWEEN, AttributeValueList must contain two AttributeValue elements of the same type, either String or Number (not a set). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue of a different type than the one specified in the request, the value does not match. For example, {"S":"6"} does not compare to {"N":"6"}. Also, {"N":"6"} does not compare to {"NS":["6", "2", "1"]}.
Can anybody explain this results?
Upvotes: 0
Views: 2952
Reputation: 204
In comparison of AttributeValue
, the value type is validated before comparing the value. If you check .equals(obj)
of AttributeValue
, that may give you a better explanation.
Upvotes: 0