I need to store a user's progress by saving a value in a DynamoDB. While storing the value is not difficult, accessing this value for use in my application has proven to be quite challenging.
When using dynamoDBWrapper.getItem(params)
, where the params resemble:
const parameters = {
Key: {
"userId": {
S: "2"
}
},
TableName: "Users",
ReturnConsumedCapacity: "TOTAL"
};
a promise is returned. However, I am struggling with storing the value of this promise in a variable. How can I effectively utilize the data from this table in my project?
UPDATE: I have tried calling the following function:
dynamoDBWrapper.getItem(parameters, function(error, information) {
if (error)
console.error(error.message);
else {
result = information.Item;
console.log("Otherwise")
}
});
No messages are displayed in the console when executing this code block. I am confident that the keys being used exist in the database as well.