【发布时间】:2018-10-31 22:32:01
【问题描述】:
我正在尝试扫描 DynamoDB 故事,以便仅获取过滤后的项目。 myTable有3列:L timestamp (String, PK), colors (String), userId (String)
var docClient = new AWS.DynamoDB.DocumentClient();
var params = {
"TableName": "myTable",
"ProjectionExpression": "colors, userId",
"ExpressionAttributeValues": {":val": userId},
"FilterExpression": "userId = :val"
};
console.log("Scanning table.");
docClient.scan((params), function(err,data){
if (err) console.log(err, err.stack);
else console.log(data); //success response
});
2018-05-22T08:04:21.395Z baac6d92-5d96-11e8-ae78-bd04c275acf5 扫描表。 2018-05-22T08:04:21.672Z baac6d92-5d96-11e8-ae78-bd04c275acf5 {项目:[{userId:'amzn1.ask.account.XYZ'}],计数:1,ScannedCount:2}
因此,我只能从 userId 列中获取值。 'colors' 列被完全忽略。
我做错了什么?
【问题讨论】:
标签: node.js aws-lambda amazon-dynamodb alexa-skills-kit alexa-skill