-
StackOverflow 文件
-
amazon-web-services 教程
-
亞馬遜 DynamoDB
-
使用 NodeJS 的 DynamoDB 基本 Crud 操作
let doc = require('dynamodb-doc');
let dynamo = new doc.DynamoDB();
var tblName = "MyTable";
exports.handler = (event, context, callback) => {
readOperation(context);
}
function readOperation(cnxt) {
var params = {
TableName: tblName,
Key: {
"id": "2013",
"topic": "Turn It Down, Or Else!"
},
AttributesToGet: [
"id", "client_name", "info"
],
ConsistentRead: false
};
dynamo.getItem(params, function(err, data) {
if (err) console.log("Error: "+err); // an error occurred
else {
var jsonDoc = JSON.parse(data.Item.info); // successful response
cnxt.succeed(jsonDoc);
}
});
}