I have a Dynamo table in which I have partition key only - "CreatedAt" and some other attributes.
I want to write a Query in which I will get no. of items where CreatedAt is between LastSunday and Today.
I have stored the date in string format as "2021-03-09T14:33:29Z".
I do not want to use GSI's.
with below query I get an error - "Query key condition not supported"
Here is my code :
var queryRequest = new QueryRequest
{
TableName = myTableName,
KeyConditionExpression = "CreatedAt BETWEEN :LastMonday AND :TodaysDate",
};
Dictionary<string, AttributeValue> expressionAttributeValues = new Dictionary<string, AttributeValue>();
expressionAttributeValues.Add(":TodaysDate", new AttributeValue { S = "2021-03-09T14:33:29Z" });
expressionAttributeValues.Add(":LastMonday", new AttributeValue { S = "2021-03-02T14:33:29Z" });
queryRequest.ExpressionAttributeValues = expressionAttributeValues;
var response = await awsDynamoClient.QueryAsync(queryRequest);