I'm trying to scan in DynamoDB without primary sort key with Nodejs. I have the following Table
var params = {
AttributeDefinitions: [
{
AttributeName: "barname",
AttributeType: "S"
},
{
AttributeName: "timestamp",
AttributeType: "S"
}
],
KeySchema: [
{
AttributeName: "barname",
KeyType: "HASH"
},
{
AttributeName: "timestamp",
KeyType: "RANGE"
}
],
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 1
},
TableName: tableName
};
I put with two objects:
data1 = {
barname: "paul",
timestamp: new Date().toISOString(),
sync: false,
number : "1234",
}
data2 = {
barname: "john",
timestamp: new Date().toISOString(),
sync: true,
number : "333",
}
How to scan all objects that barname = 'john' and sync = true ?
I tried something like that:
var params = {
TableName: tableName,
FilterExpression: "sync = :sync and barname = :barname",
ExpressionAttributeValues: {
':barname' : {S: 'john'},
':sync' : {BOOL: true}
},
};
dynamodb.scan(params, function(err, data){ ... }
The scan doesn't find anything:
{ Items: [], Count: 0, ScannedCount: 4 }
But i have 2 objects that match:

ExpressionAttributeValuesforsyncvalue.':sync' : {BOOL: true}FilterExpressioninstead.