AWS DynamoDB Scan filterExpression - prime comparison

I am trying to do a simple dynamoDB scan with a filter expression ( here)

This is my line of expression:

"attribute_exists("my_db_key") AND ("my_db_key" = 1)"

It just means:

"If the value AND my_db_key EQUALS 1 exists for my_db_key, return it to the results"

However, this does not work, and I get this error:

Invalid FilterExpression: Syntax error; token: "1", near: "= 1)

I know that I can use the value placeholder attribute for values ​​and then use this in an expression, but I don't want to do this. And according to Amazon documentation, this is NOT required.

So how do I make this simple expression? Does anyone have an example or a link to the documentation? Unfortunately, Amazon documentation does not help.

. AWSDynamoDBScanInput iOS, , .

+4
2

. AWS

+1

( Node AWS):

params = {
  "FilterExpression": 'attribute_exists("my_db_key") AND ("my_db_key" = :value)',
  "ExpressionAttributeValues": {
    ":value": 1
  },
  // ...
};

docClient.scan(params, function(err, data){
  // Handle err or process data
})

:

{
  "FilterExpression": 'attribute_exists("my_db_key") AND ("my_db_key" = :value)',
  "ExpressionAttributeValues": {
    ":value": {"N":1}
  },
  // ...
};
+3

All Articles