I had the same problem and Harshal Bulsara helped me. Go to Download AWS SDK for PHP and update your SDK. Worked for me!
QueryFilter not working inside query operation in dynamodb
-
12-07-2023 - |
Question
$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);
then response:
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" } }
}
but i want to only "status"=0,
i have already used QueryFilter inside status condition but not working...
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow