uppercase and lowercase not working in Contains in Aws dynamoDB?

Viewed 4852

I have a DynamoDB database with an attribute Event_Name which has uppercase values, for example KRISHNA. When I specify a Scan FilterExpression comparitor CONTAINS with a lowercase value, for example krishna, the item with value KRISHNA is not returned. When I use the uppercase value it returns the item. Please help me.

For reference my code is:

var params = {
    TableName: "User",
    FilterExpression: "NOT userId in (:a) and contains(Event_Name, :name)",
    ExpressionAttributeValues: {
        ":a": {
            S: $scope.userid
        },
        ":name": {
            S: namekey
        }
    }
};

using dynamodb scan method

1 Answers

Probably you already figured out, but since I stumbled upon this question and it's not closed, here is a link in AWS forum addressing the issue

https://forums.aws.amazon.com/thread.jspa?threadID=92159

DynamoDB is case sensitive. If your data is case insensitive, one solution is to lower case or upper case the data before storing it in DynamoDB. Then you can get around this by querying for all lower case or all upper case. You will need to take locale into account for locale-sensitive ordering.

So there is nothing wrong you are doing, you just were expecting something that is not available with DynamoDB

Related