I am working on a Node.js server for a game I have created. The server acts as an api to retrieve user account info including their personal high scores. I have an individual item for each account which contains their username and a list of their scores for the game. I can't seem to find any example code for inserting values into a list in DynamoDB and I was hoping someone could help me with this. I'm not finding documentation for this specific action. I have simply been trying to use the putitem function that I know works for inserting strings and other data types, but I have had no luck with inserting into a list data type. My most recent attempt at this looks like the following:
var params = {
TableName : "userscores",
Item:{
"username" : {"S": username},
"scores" : {"L": {"S": score}}
}
}
dynamodb.putItem(params, function(err, data) {
if(err)
console.log(err);
else
console.log(JSON.stringify(data));
});
The error looks like this: { [InvalidParameterType: Expected params.Item['scores'].L to be an Array] message: 'Expected params.Item[\'scores\'].L to be an Array', code: 'InvalidParameterType'
I understand why this block doesn't work, but I don't understand how to do this. Any help would be greatly appreciated!