问题描述
在DynamoDB中,我想使用 BETWEEN
ComparisonOperator进行查询,但是我在语法上陷入了困境。
In DynamoDB I would like to make a query using the BETWEEN
ComparisonOperator, but I am getting stuck on the syntax.
从我发现这应该是完成的方式:
From what I could find this should be how it is done:
$iterator = $client->query(array(
'TableName' => 'test',
'IndexName' => 'lft-index',
'KeyConditions' => array(
'lft' => array(
'AttributeValueList' => array(
array(
'N' => 15
),
array(
'N' => 18),
),
'ComparisonOperator' => 'BETWEEN',
),
),
));
使用此代码,我将收到错误消息:AWS错误消息:不支持查询键条件
With this code, I get the error message: AWS Error Message: Query key condition not supported
推荐答案
到目前为止,您不能使用BETWEEN运算符作为哈希键,我假设'lft'是您的散列键。
You cannot use BETWEEN operator for Hash keys as of now, I am assuming 'lft' is your hash key.
查询DynamoDB时,您只必须使用Equality运算符传递散列键。您可以选择与其他运算符一起传递Range键。
When you query DynamoDB you have to pass Hash key with Equality operator only. You can optionally pass Range key with other operators.
请参考
这篇关于用BETWEEN ComparisonOperator查询dynamodb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!