DynamoDB how to use a filter expression on a bool value

Viewed 8448

How do I filter a dynamoDB table with an expression on a bool value. I can filter successfully on an Int or String value. But even in the web console when trying to create a filter expression on a bool value it won't give any results back?

I'm trying this from Swift on iOS as well, but the fact that it doesn't even work int he web interface makes me wonder how to at all achieve this.

If I filter on an Int it works, i.e.

    let queryExpression = AWSDynamoDBQueryExpression()
    queryExpression.rangeKeyConditionExpression = "age = :val"
    queryExpression.expressionAttributeValues = [":val": 30]

But if I try on an Bool it comes back with nothing.

    let queryExpression = AWSDynamoDBQueryExpression()
    queryExpression.rangeKeyConditionExpression = "enabled = :val"
    queryExpression.expressionAttributeValues = [":val": true]

I've also tried a 0 or a 1 in place of true, or a string as in "true".

However, this filtering on an Bool doesn't even work in the AWS web interface. So it's not a Swift thing it seems. Maybe it's not possible, but seems odd.

Turns out I was confused here, filterExpression works fine.

   let scanExpression = AWSDynamoDBScanExpression()
   scanExpression.filterExpression = "disabled = :val"
   scanExpression.expressionAttributeValues = [":val": false]
1 Answers
Related