การใช้ NOT_CONTAINS ในการเขียนแบบมีเงื่อนไขผ่าน DynamoDBMapper

ฉันต้องการอัปเดตบันทึกในตาราง DynamoDB ตามเงื่อนไขด้านล่างซึ่งระบุว่า "อัปเดตบันทึกเฉพาะเมื่อค่าแอตทริบิวต์เป็นของค่าที่ระบุในรายการ"

ข้อมูลโค้ด:

AttributeValue inProgressStatus = new AttributeValue("IN_PROGRESS");
AttributeValue successStatus = new AttributeValue("SUCCESS");

ExpectedAttributeValue expectedAttributeValue = new ExpectedAttributeValue();
expectedAttributeValue.setAttributeValueList(Arrays.asList(inProgressStatus, successStatus));
expectedAttributeValue.setComparisonOperator(ComparisonOperator.NOT_CONTAINS);

ขณะดำเนินการอัปเดตแบบมีเงื่อนไข ฉันได้รับข้อยกเว้นต่อไปนี้:

com.amazonaws.AmazonServiceException: One or more parameter values were invalid: 
Invalid number of argument(s) for the NOT_CONTAINS ComparisonOperator (Service: null; Status Code: 400; Error Code: ValidationException; Request ID: null).

โปรดแจ้งให้เราทราบว่าฉันจะใช้งานฟังก์ชันต่างๆ ได้อย่างไรโดยใช้ตัวดำเนินการ NOT_CONTAINS


person Prashant Choyal    schedule 12.07.2016    source แหล่งที่มา


คำตอบ (1)


NOT_CONTAINS สามารถมีได้เพียงอันเดียว AttributeValue และคุณมีสองอัน โปรดดูเอกสารประกอบสำหรับเงื่อนไข DynamoDB รวมถึง NOT_CONTAINS ที่ http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html

person jzonthemtn    schedule 12.07.2016
comment
ไม่ตอบคำถามตามความเป็นจริง - person Matheus; 08.05.2018