I am trying to limit the total number of results that can return with an iterator to 3. Not the number of results for each iteration. I hope to make this number dynamic. However, I cannot find a real answer to accomplish this, and the documentation provided by AWS will not help. Placing a limit inside an array with a table name and keys does not limit the results. I also put it in my own separate array, but that doesn't work either. Below I tried, but I could not get this to work. Any help would be greatly appreciated.
$iterator = $dbh->getIterator('Query', array( 'TableName' => 'raw', 'KeyConditions' => array( 'deviceID' => array( 'AttributeValueList' => array( array('S' => $deviceID) ), 'ComparisonOperator' => 'EQ' ) ), 'ScanIndexForward' => false
Then put the received data into an array. I donβt know if I need to change anything here?
foreach ($iterator as $item) { array_push($resultArray, $item); }
source share