'How to scan/query dynamodb list in php to check if value exists?

My table looks

{
  "ID": {
    "S": "123456"
  },
  "info_id": {
    "L": [
      {
        "S": "7CDA"
      },
      {
        "S": "7C"
      }
    ]
  },

I want to scan\query to check if $number exists in the dynamodb table using php. Trying to find https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.PHP.04.html but unable to find any documentation. My code looks something like

            function checking($number){
            $client = new DynamoDbClient([
                'region'      => 'us-west-2',
                'version'     => 'latest',
            ]);
            $marshaler = new Marshaler();
            $eav = $marshaler->marshalItem([":info_id" => $number]);
            
            $params = [
                'TableName' => 'information',
                'FilterExpression' => 'info_id = :info_id',
                'ExpressionAttributeValues'=> $eav
            ];
            $result = $client->scan($params);
}


Solution 1:[1]

You will have to scan with a filter expression like contains(info_id, :info_id). However

scans are expensive

so if this is a common access pattern, you'll want to revisit your storage layout.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marc L.