1

I have 2 problems. I want to query a dynamodb database on Bool and on Date.

Is this possible as I only see String Number and Binary?

1 Answer 1

2

There are two types of expressions.

KeyConditionExpression - Supports only String, Number and Binary

FilterExpression - Can be used for Non-Key attributes. You can query for the Date and BOOL attributes.

There is a BETWEEN operator which can be used for DATE range as well.

Code to filter by Date:-

var params = {
    TableName : table,
    KeyConditionExpression : 'email = :email',
    FilterExpression: 'createdAt = :createdAt',
    ExpressionAttributeValues : {
        ':email' : '[email protected]',
        ':createdAt' :  "2016-11-07"
    }   
};

My Item:-

Date is stored as String in database.

Date S (string type). The Date values are stored as ISO-8601 formatted strings.

DynamoDB Item

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

5 Comments

I cannot get FilterExpression to query for Bool or Date
See this other post I have stackoverflow.com/questions/40461910/…
You haven't answered the other post
other stack posters seem to exprience the same issue too
I'm pretty sure this is some nasty hack on the DynamoDB side. I'd use integer timestamp and query that. Can't fool a number.

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.