I have been trying to use DynamoDB mapper for creating save expressions. I want to save a record iff
- A particular attribute value doesn't exist. OR
- That attribute value should be greater than a particular value.
So I have created an expression for it, but it throws IllegalArgumentException
.
expected.put("date",
new ExpectedAttributeValue(new AttributeValue()
.withN(Long.toString(date.toEpochMilli())))
.withComparisonOperator(ComparisonOperator.LT));
expected.put("date", new ExpectedAttributeValue(false));
saveExpression.withConditionalOperator(ConditionalOperator.OR);
saveExpression.setExpected(expected);
This is the kind of exception I'm getting.
java.lang.IllegalArgumentException: Unable to assert the value of the fields [version], since the expected value conditions cannot be combined with user-specified conditions joined by "OR"
I was wondering if I'm missing something or is there something wrong??
Edit
Looks like I couldn't use an OR operation between two internal conditions. Is it possible to do OR-ing in some way?? Thanks in advance.