In a DynamoDB table, I have an item with the following scheme:
{
id: 427,
type: 'page',
...other_data
}
When querying on primary index (id), I get the item returned as expected.
With a scan operation inside AWS DynamoDB web app to get all items with type page, 188 items including this missing item are returned. However, performing this scan operation inside Lambda with the AWS SDK, only 162 items are returned. Part of the code looks like:
const params = {
TableName: <my-table-name>,
FilterExpression: '#type = :type',
ExpressionAttributeNames: { '#type': 'type' },
ExpressionAttributeValues: { ':type': 'page' }
};
dynamodb.scan(params, (error, result) => {
if (error) {
console.log('error', error);
} else {
console.log(result.Items); // 162 items
}
});
What is missing here?