I have a AWS DynamoDB table with columns email(partition key) and password.
I want to run a query with fetch matching records with combination of giving email and password.
I am using JavaScript(NodeJs) AWS SDK for integration.
But I am facing some challenges while executing my query, below are my code block which I am using-
var params = {
TableName : "tblUsers",
KeyConditionExpression : 'email = :emailValue',
FilterExpression : '#password= :passwordValue',
ExpressionAttributeNames : {
'#password' : 'password'
},
ExpressionAttributeValues : {
':emailValue' : email,
':passwordValue' : password
}
};
dynamodb.query(params, function(err, data) {
if (err) {
console.log("Error", err);
} else {
//console.log("Success", data.Items);
data.Items.forEach(function(element, index, array) {
console.log(element);
});
}
});
Below are errors I am getting -
Error MultipleValidationErrors: There were 8 validation errors:
* InvalidParameterType: Expected params.ExpressionAttributeValues[':value'] to be a structure
* UnexpectedParameter: Unexpected key '0' found in params.ExpressionAttributeValues[':value']
* UnexpectedParameter: Unexpected key '1' found in params.ExpressionAttributeValues[':value']
* UnexpectedParameter: Unexpected key '2' found in params.ExpressionAttributeValues[':value']
* UnexpectedParameter: Unexpected key '3' found in params.ExpressionAttributeValues[':value']
* UnexpectedParameter: Unexpected key '4' found in params.ExpressionAttributeValues[':value']
* UnexpectedParameter: Unexpected key '5' found in params.ExpressionAttributeValues[':value']
* UnexpectedParameter: Unexpected key '6' found in params.ExpressionAttributeValues[':value']