A map of attribute/condition pairs. This is the conditional block for the PutItem operation. Expected allows you to provide an
attribute name, and whether or not DynamoDB should check to see if the attribute value already exists; or if the attribute value exists and
has a particular value before changing it. Each item in Expected represents an attribute name for DynamoDB to check, along with the
following:
- Value - A value for DynamoDB to compare with an attribute. When performing the comparison, strongly consistent reads are used.
- Exists - Causes DynamoDB to evaluate the value before attempting a conditional operation:
- If Exists is true, DynamoDB will check to see if that attribute value already exists in the table. If it is found, then the operation succeeds. If it is not found, the operation fails with a ConditionalCheckFailedException.
- If Exists is false, DynamoDB assumes that the attribute value does not exist in the table. If in fact the value does not exist, then the assumption is valid and the operation succeeds. If the value is found, despite the assumption that it does not exist, the operation fails with a ConditionalCheckFailedException.
- Exists is true but there is no Value to check. (You expect a value to exist, but don't specify what that value is.)
- Exists is false but you also specify a Value. (You cannot expect an attribute to have a value, while also expecting it not to exist.)
Declaration Syntax
C# |
public Dictionary<string, ExpectedAttributeValue> Expected { get; set; }