QueryFilter在dynamodb中的查询操作中不起作用

时间:2014-04-30 10:28:22

标签: php amazon-dynamodb nosql

$response = array(
    "TableName" => "tableName",
    "AttributesToGet" => array('user_id'),
    "ConditionalOperator" => 'AND',
    "IndexName" => "indexname",
    "KeyConditions" => array(
        // Global Secondary HASH Key
        'id' => array(
            "ComparisonOperator" => 'EQ',
            "AttributeValueList" => array(
                array('S' => (string)$id)
            )
        ),
        // Global Secondary Range Key
        'date' => array(
            "ComparisonOperator" => 'EQ',
            "AttributeValueList" => array(
                array('S' => (string)$date)
            )
        ),

    ),
    'QueryFilter' => array(
        // no index 
        'status' => array(
            'ComparisonOperator' => 'EQ',
            'AttributeValueList' => array(
                array( 'S' => (string)"0")
            )
        )
    ),
);
$result = $client->query($response);
var_dump($result);

然后回复:

  array(2) { [0]=> array(2) { 
                    ["status"]=> array(1) { ["S"]=> string(1) "1" } 
                    ["user_id"]=> array(1) { ["S"]=> string(17) "20140425153549703" } } 
            [1]=> array(2) { 
                    ["status"]=> array(1) { ["S"]=> string(1) "0" } 
                    ["user_id"]=> array(1) { ["S"]=> string(17) "20140421162848857" } } 
         } 

但我只希望" status" = 0,

我已经在状态条件中使用了QueryFilter但是没有工作......

1 个答案:

答案 0 :(得分:3)

我遇到了同样的问题,Harshal Bulsara帮助了我。 转到Download AWS SDK for PHP并更新您的SDK。 为我工作!