【发布时间】:2017-04-01 20:44:04
【问题描述】:
下面的函数,应该很简单吧?这也是我的想法。尽管如此,对于我的生活,我无法弄清楚为什么我不断收到错误消息,通知我“ValidationException”,错误消息通知我“Query key condition not supported”。
const getUpdated = (refreshDatetime, callback) => {
refreshDatetime = parseInt(refreshDatetime);
docClient.query({
TableName: 'aw-reach',
IndexName: 'updateDatetime-index',
KeyConditionExpression: ':refreshDatetime < updateDatetime',
ExpressionAttributeValues: {
':refreshDatetime': refreshDatetime,
}
}, (error, data) => {
if (error) callback(error, null);
callback(null, data.Items);
});
};
只是为了确保我没有做任何其他非常愚蠢的事情(也很可能),这是我用来测试的 sn-p。
const refreshDatetime = Date.parse('01 Jan 2015');
getUpdated(refreshDatetime, (error, response) => {
console.log(JSON.stringify(response));
});
在编写代码时,欢迎并非常感谢洞察力和想法,即使是这个小代码,也绝对不是我的最强天赋!
更新:要添加更多详细信息,我的哈希键是 reachId,与二级索引关联的分区键是 updateDatetime。
【问题讨论】:
-
refreshDatetime 是你的哈希键吗?
-
是与索引关联的分区键。
标签: javascript node.js amazon-web-services amazon-dynamodb aws-lambda