I'm attempting to read all values in a DynamoDB table above a certain value. I have the primary partition key set to a Number called Project_ID.
I am running a query to see all values above a certain ID - mostly to test out functionality, however I am getting an error when running the code.
The code:
var params = {
TableName : document.getElementById(tableName).value,
KeyConditionExpression: Project_ID > :v1,
ExpressionAttributeValues: {
:v1: {N: 0}
}
};
docClient.query(params, function(err, data) {
if (err) {
document.getElementById('textarea').innerHTML += Unable to query. Error: + n + JSON.stringify(err, undefined, 2);
} else {
data.Items.forEach(function(project) {
//JSON.stringify(project);
document.getElementById('textarea').innerHTML += n + project.Project_Name + : + project.Project_Ref;
});
}
});
The output
`Unable to query. Error: {
message: Invalid KeyConditionExpression: Incorrect operand type for operator or function; operator or function: >, operand type: M,
code: ValidationException,
time: 2017-04-28T10:52:31.381Z,`