I have a small nodejs script connected to my DynamoDB and one of my primary sort keys is datetime, which is represented in UTC.
I would like to filter the results by a certain date and time and am having issues with my Filter Expression.
var params = {
TableName: "realtimeusers",
ProjectionExpression: "brand, datetime, activeusers",
KeyConditionExpression: "brand = :brand",
FilterExpression: "datetime > :today",
ExpressionAttributeValues: {
":brand": "BRAND A",
":today": 1464705900
},
};
I get the error message:
"message": "Invalid FilterExpression: Attribute name is a reserved keyword; reserved keyword: datetime",
I think I am missing something in my filter expression that I don't fully grasp.
Can some one please help?
"datetime" is a reserved dynamo keyword. The reserved keywords are not allowed in dynamo query expressions.
The way around this is to use Expression attribute names when querying for such properties.
Reference: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ExpressionPlaceholders.html#ExpressionAttributeNames
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With