id and status, what will be the output of this filter expression?FilterExpression: "attribute_exists(status) AND status = :val"with
:val set to "active"?attribute_exists means and how it combines with the equality check.The filter expression attribute_exists(status) AND status = :val means the item must have the status attribute and its value must be exactly "active". Items missing status or with a different value are excluded.
username attribute?FilterExpression: "begins_with(username, :prefix)"with
:prefix set to "user"?begins_with checks in DynamoDB.The begins_with function filters items whose attribute value starts exactly with the given prefix. It does not check for substring or suffix.
Expression:
FilterExpression: "status = :val AND (attribute_exists(age) OR age > :minAge"Assume
:val and :minAge are defined.The filter expression has an opening parenthesis before attribute_exists(age) but no matching closing parenthesis. This causes a syntax error.
score is between 50 and 100 inclusive in DynamoDB?The BETWEEN operator is optimized for range checks and is more readable and efficient than combining two comparisons with AND. The IN operator checks for exact matches, not ranges.
Filter expressions are applied after DynamoDB reads the items. They do not reduce the number of items read, so the RCUs consumed are based on the total items scanned, not filtered.