我在" DynamoDB的入门指南"的步骤5.1中。 http://docs.aws.amazon.com/amazondynamodb/latest/gettingstartedguide/GettingStarted.JsShell.05.html#GettingStarted.JsShell.05.01并被一个非工作示例阻止。
var params = {
TableName: "Music",
KeyConditionExpression: "Artist = :artist",
ExpressionAttributeValues: {
":artist": "No One You Know"
}
};
dynamodb.query(params, function(err, data) {
if (err)
console.log(JSON.stringify(err, null, 2));
else
console.log(JSON.stringify(data, null, 2));
});
shell接受输入但产生错误
{
"message": "There were 2 validation errors:\n* MissingRequiredParameter: Missing required key 'KeyConditions' in params\n* UnexpectedParameter: Unexpected key 'KeyConditionExpression' found in params",
"code": "MultipleValidationErrors",
"errors": [
{
"message": "Missing required key 'KeyConditions' in params",
"code": "MissingRequiredParameter",
"time": "2015-10-27T03:08:56.504Z"
},
{
"message": "Unexpected key 'KeyConditionExpression' found in params",
"code": "UnexpectedParameter",
"time": "2015-10-27T03:08:56.504Z"
}
],
"time": "2015-10-27T03:08:56.504Z"
}
我尝试过分析' KeyConditions' for ExpressionAttributeValues'像...
var params = {
TableName: "Music",
KeyConditionExpression: "Artist = :artist",
KeyConditions: {
":artist": "No One You Know"
}
};
dynamodb.query(params, function(err, data) {
if (err)
console.log(JSON.stringify(err, null, 2));
else
console.log(JSON.stringify(data, null, 2));
});
...但这只会产生空结果{}。当然,音乐"音乐"与#34;艺术家"属性设置为"没有人知道",所以我有点失去了如何继续前进。
查询DDB的正确表达式是什么?#34; No One You Know"在Artist属性?
答案 0 :(得分:1)
这是一个陈旧的“dynamodb-local”装置。 brew upgrade dynamodb-local
部署了这个孩子的2015-07-16_1.0版本,现在查询有效。