【问题标题】:DynamoDB Error: "Query key condition not supported"DynamoDB 错误:“不支持查询键条件”
【发布时间】:2018-11-20 20:47:41
【问题描述】:

我正在从 aws dynamodb 中的数据库查询数据,并在 KeyConditionExpression 上遇到错误消息。

我正在查询“dominant_temporality”和“dt”。这些构成了我的复合分区键 - dt 对于每一行和我的排序键都是唯一的。

我正在运行的代码:

var params = {
    TableName : "deardiary",
    KeyConditionExpression: "#d = :dominant_temporality and dt between :minDate and :maxDate",
    ExpressionAttributeNames: { 
        "#d" : "temporality"
    },
    ExpressionAttributeValues: { // the query values
        ":dominant_temporality": {S: "present"},
        ":minDate": {N: new Date("October 8, 2018").valueOf().toString()},
        ":maxDate": {N: new Date("October 9, 2018").valueOf().toString()}
    }
};

【问题讨论】:

  • 您需要检查您的表分区键和范围键是什么。 dt 是你的范围键吗?
  • 是的 - 我正在尝试对条目进行排序
  • keyConditionExpression 中不能按排序键查询。请在此处查看我的答案:stackoverflow.com/questions/53167165/…

标签: nosql amazon-dynamodb


【解决方案1】:

检查您是否在不允许的 HASH 上使用 BETWEEN - 您只能将 EQ 用于 HASH 或 begins_with 用于范围键。

【讨论】:

    猜你喜欢
    • 2015-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多