I have an API Gateway GET endpoint that scans a DynamoDB table and retrieve results according to a Limit parameter:
requestTemplates:
application/json: >-
{
"TableName": "employee",
"Limit": 2
}
It is properly working and the response for this request when I send a limit = 2 is:
{
"Count":2,
"Items":[
{
"id":{
"S":"18"
},
"department":{
"S":"sales"
},
"name":{
"S":"Roger"
}
},
{
"id":{
"S":"16"
},
"department":{
"S":"technology"
},
"name":{
"S":"Petterson"
}
}
],
"LastEvaluatedKey":{
"id":{
"S":"16"
}
},
"ScannedCount":2
}
The problem is: I have 20 records stored in this table, and the ScannedCount and Count are both equal to 2.
I really need to know the count of the total amount of records I have stored in order to make a pagination frontend componenet to work.
I've looked through the documentation and a see that the expected result for this request would be ScannedCount = 2 and Count = 20.
Is there a way to have it? Thanks a lot.