Rafael D'Arrigo
Rafael D'Arrigo

Reputation: 110

QueryFilter not working in DynamoDB

I'm trying to query all queued notifications of my table 'notifications' table in DynamoDB.

Global Secondary Indexes: Name: idTo-time-index
Hash Key: idTo (Number)
Range Key: time (Number)

Why I'm getting all results and not only the ones with status=='queued'?

$params = array(
    'TableName' => 'notifications',
    'IndexName' => 'idTo-time-index',
    'KeyConditions' => array(
        "idTo" => array(
            "AttributeValueList" => array(
                array('N' => 1)
            ),
            "ComparisonOperator" => "EQ"
        )
    ),
    'ScanIndexForward' => false,
    'QueryFilter' => array(
        "status" => array(
            "AttributeValueList" => array(
                array('S' => (string)"queued")
            ),
            "ComparisonOperator" => "EQ"
        )
    ),
);

$response = $dynoClient->query($params);

Upvotes: 3

Views: 789

Answers (1)

Harshal Bulsara
Harshal Bulsara

Reputation: 8254

I had the same problem, I solve that problem by updating the ASW SDK, the reason is that query filter was added recently, in my old SDK when i execute the same query then Query filter was not working.

Updating the SDK should solve your problem

Hope that helps

Upvotes: 1

Related Questions