Home Ask Login Register

Developers Planet

Your answer is one click away!

Foddy February 2016

How to query a StringSet value in DynamoDB (iOS)?

I am trying to find out how to search some rows with a specific tag contained in a StringSet in AWS DynamoDB with the AWS SDK v2 for iOS.

I couldn't find anything for doing this in the official Amazon iOS documentation for DynamoDB, so I tried this expression but it doesn't work:

let queryExpression = AWSDynamoDBQueryExpression()
queryExpression.limit = 300
queryExpression.filterExpression = "tags CONTAINS :tag"
queryExpression.expressionAttributeValues = [":tag": self.searchQueryTag]

Global.appDelegate().dynamoDBObjectMapper.query(BlogPost.self, expression: queryExpression)
    .continueWithBlock({(task: AWSTask) -> AnyObject? in

    if (task.exception != nil || task.error != nil)
        completion(response: 0)
    else if ((task.result) != nil)
        if(task.result!.count > 0)
            // LIST ALL IDS…
            completion(response: 0)

    return nil

Can somebody teach me how to query as specific string in StringSets (NSSets) in DynamoDB by using the AWS iOS SDK?


Yosuke Matsuda February 2016

CONTAINS is not a valid Condition Expressions (contains is a valid function, though). IN seems to be the one you need here. You should read Syntax for Condition Expressions for more details.

Post Status

Asked in February 2016
Viewed 1,752 times
Voted 4
Answered 1 times


Leave an answer

Quote of the day: live life