DynamoDB getItem returns 空项目

DynamoDB getItem returns empty item

我在 Node 中使用 aws-sdk 并尝试从 DynamoDB table 获取项目,但它只打印 Success {} 而不是项目的实际内容。有谁知道如何获取项目的实际内容?

我使用的节点脚本如下:

// Load the AWS SDK for Node.js
var AWS = require('aws-sdk');

// Set the region 
AWS.config.update({region: 'ap-southeast-2'});

// Create the DynamoDB service object
var ddb = new AWS.DynamoDB({apiVersion: '2012-08-10'});

var params = {
  TableName: 'test_table',
  Key: {
    'TWEET_KEY' : {S: 'Test'}
  },
  ProjectionExpression: 'ATTRIBUTE_NAME'
};

// Call DynamoDB to read the item from the table
ddb.getItem(params, function(err, data) {
  if (err) {
    console.log("Error", err);
  } else {
    console.log("Success", data.Item);
  }
});

我试图获取的 DynamoDB test_table 中的实际数据如下:

非常感谢!

这里- ProjectionExpression: 'ATTRIBUTE_NAME',你需要设置你需要获取的属性名,或者直接去掉它来获取整个记录内容。