I'm looking for assistance on how I can achieve the schema below into my dynamodb database.
Example of my JSON
var users = [{
userId: 123,
userName: "John Smith",
additionalInfomation: [
["favoriteColor", "blue"],
["hobbies", "ping-pong"]
]
}]
This is what I have so far to achieve the userId and userName schema. I'm having trouble setting up additionalInfomation part.
const params = {
AttributeDefinitions: [
{
AttributeName: 'userId',
AttributeType: 'N'
},
{
AttributeName: 'userName',
AttributeType: 'S'
},
{
AttributeName: 'additionalInformation',
AttributeType: <NEED HELP HERE> // <-------------------- ?????
}
],
KeySchema: [
{
AttributeName: 'userId',
KeyType: 'HASH'
},
{
AttributeName: 'userName',
KeyType: 'RANGE'
},
{
AttributeName: 'additionalInformation',
KeyType: <NEED HELP HERE> // <-------------------- ?????
}
],
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 1
},
TableName: 'USERS',
StreamSpecification: {
StreamEnabled: false
}
};
// Call DynamoDB to create the table
ddb.createTable(params, function(err, data) {
if (err) {
console.log('Error', err);
} else {
console.log('Table Created', data);
}
});
Need help setting the additionalInformation schema up. Please excuse my ignorance if this isn't the right approach. Still learning dynamoDB and the aws doc isn't quite helpful for a beginner.