查询dynamoDB与关键条件“GE”的散列关键字 [英] Query dynamoDB with key condition 'GE' on a hash key

查看:762
本文介绍了查询dynamoDB与关键条件“GE”的散列关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用关键条件是这样的

I'm trying to run a query on a dynamoDB table with the key condition as such

KeyConditions: {
  userID: {
    ComparisonOperator: 'GE',
    AttributeValueList: [{N: '0'}]
  }
}

当我运行此查询与ComparisonOperator为情商不发生任何问题。然而,当它的GE我得到一个错误,指出不支持查询的关键条件。

When I run this query with the ComparisonOperator as 'EQ' no problems occur. However when it's 'GE' I get an error stating that the query key condition is not supported.

需要注意的是用户ID是一个哈希键

Note that userID is a hash key

推荐答案

从的迪纳摩DB查询文档

查询操作直接访问使用该表的主键从一个表中的项目,或者使用索引键索引。您必须提供一个特定的散列键值。您可以通过使用比较操作上的一系列键值缩小查询范围,或索引键。您可以使用ScanIndexForward参数得到的结果正向或反向顺序,按范围键或索引键。

A Query operation directly accesses items from a table using the table primary key, or from an index using the index key. You must provide a specific hash key value. You can narrow the scope of the query by using comparison operators on the range key value, or on the index key. You can use the ScanIndexForward parameter to get results in forward or reverse order, by range key or by index key.

您必须提供散列关键字来查询迪纳摩DB。你可以做到你想要做一个扫描运行或多个查询操作什么,但是没有办法指定其他条件不是等于在DynamoDB的哈希键。

You must provide a hash key to query Dynamo DB. You could accomplish what you're trying to do with a Scan operation or with multiple Query operations, but there's no way to specify a condition other than equals for a hash key in DynamoDB.

这篇关于查询dynamoDB与关键条件“GE”的散列关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆