Sono nuovo di javascript e node.js e mi chiedevo se qualcuno può aiutarmi a capire la sintassi di mettere un nuovo elemento su una tabella esistente su AWS Dynamodb attraverso il loro SDK node.js. Ecco cosa ho finora. C'è un esempio per quello che sto cercando di fare? Se qualcuno potesse indicarmi la giusta direzione, sarebbe molto apprezzato.Inserisci elemento sulla tabella DynamoDB utilizzando AWS SDK per Node.js
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./config.json');
AWS.config.update({region: 'us-east-1'});
var dynamodb = new AWS.DynamoDB();
var item = {
// I need to put the an item with a the primary key of "id", and an attribute called "item"
// I'm new to js and node.js, so if somebody could help me understand the documentation
// http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/frames.html#!http%3A//docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB_20120810.html
}
dynamodb.putItem({TableName: 'log_dev', Item: item}, function(err, data){
if (err) {
console.log(err); // an error occurred
} else {
console.log(data); // successful response
}
});
[DynamoDB-marshalling] (https://github.com/CascadeEnergy/dynamoDb-marshaler) aiuterà ad alleviare il dolore di formattazione – tsuz