我正在尝试使用这样的关键条件在 dynamoDB 表上运行查询
KeyConditions: {
userID: {
ComparisonOperator: 'GE',
AttributeValueList: [{N: '0'}]
}
}
当我使用 ComparisonOperator 作为“EQ”运行此查询时,没有出现任何问题。但是,当它是“GE”时,我收到一条错误消息,指出不支持查询键条件。
注意userID是一个hash key
最佳答案
来自Dynamo DB Query Documentation :
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.
您必须提供哈希键才能查询 Dynamo DB。您可以通过 Scan
操作或多个 Query
操作来完成您尝试做的事情,但是除了 equals 中的哈希键之外,没有其他方法可以指定条件DynamoDB。
关于javascript - 在哈希键上使用键条件 'GE' 查询 dynamoDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22696538/