Hello, when running a scan
operation, the web based shell returns many items. When I run the same query within the javascript lambda function, the items are empty (please find the output below). You can see three requests with the lambda function for DynamoDB, since the EvaluatedKey
is added to search all of the items. The requests are identical, but the response are very different.
DynamoDB JavaScript shell via localhost:8000/shell (without EvaluatedKey)
Request
var params = {
TableName: 'schools',
FilterExpression: '#school_name = :value',
ExpressionAttributeNames: { '#school_name': 'name' },
ExpressionAttributeValues: { ':value': { S: 'School 1' } }
};
dynamodb.scan(params, function(err, data) {
if (err) ppJson(err); // an error occurred
else ppJson(data); // successful response
});
Response
{ Items: [............],
Count: 74,
ScannedCount: 74,
LastEvaluatedKey: { id: '6fcbcaf8-d4fc-4484-a74f-7ce9b18cbc6f' } }
Lamda parameters for DynamoDB
1. Request
{ TableName: 'schools',
FilterExpression: '#school_name = :value',
ExpressionAttributeNames: { '#school_name': 'name' },
ExpressionAttributeValues: { ':value': { S: 'School 1' } } }
1. Response
{ Items: [],
Count: 0,
ScannedCount: 74,
LastEvaluatedKey: { id: '6fcbcaf8-d4fc-4484-a74f-7ce9b18cbc6f' } }
2. Request
{ TableName: 'schools',
FilterExpression: '#school_name = :value',
ExpressionAttributeNames: { '#school_name': 'name' },
ExpressionAttributeValues: { ':value': { S: 'School 1' } },
ExclusiveStartKey: { id: '6fcbcaf8-d4fc-4484-a74f-7ce9b18cbc6f' } }
2. Response
{ Items: [],
Count: 0,
ScannedCount: 23,
LastEvaluatedKey: { id: '6fcbcaf8-d4fc-4484-a74f-7ce9b18cbc6e' } }
3. Request
{ TableName: 'schools',
FilterExpression: '#school_name = :value',
ExpressionAttributeNames: { '#school_name': 'name' },
ExpressionAttributeValues: { ':value': { S: 'School 1' } },
ExclusiveStartKey: { id: '6fcbcaf8-d4fc-4484-a74f-7ce9b18cbc6e' } }
3. Response
{ Items: [], Count: 0, ScannedCount: 3 }