1
當試圖做通過AWS Java SDK的一個刪除我的錯誤AWS DynamoDB刪除通過Java SDK
所提供的關鍵要素不匹配模式(服務:AmazonDynamoDBv2;狀態代碼:400;錯誤代碼:ValidationException;請求ID:52N303HS3D535K28KSN3R3803VVV4KQNSO5AEMVJF66Q9ASUAAJG)
我有一個刪除項規範中定義看起來像這樣
DeleteItemSpec deleteItemSpec = new DeleteItemSpec()
.withPrimaryKey("pk", messageId)
.withConditionExpression("#ip > :val")
.withNameMap(new NameMap()
.with("#ip", "timestamp"))
.withValueMap(new ValueMap()
.withNumber(":val", 0))
.withReturnValues(ReturnValue.NONE);
而我的桌子是這樣創建的
List<AttributeDefinition> attributeDefinitions = new ArrayList<>();
attributeDefinitions.add(new AttributeDefinition()
.withAttributeName("pk")
.withAttributeType(ScalarAttributeType.S));
attributeDefinitions.add(new AttributeDefinition()
.withAttributeName("timestamp")
.withAttributeType(ScalarAttributeType.N));
List<KeySchemaElement> keySchema = new ArrayList<>();
keySchema.add(new KeySchemaElement()
.withAttributeName("pk")
.withKeyType(KeyType.HASH));
keySchema.add(new KeySchemaElement()
.withAttributeName("timestamp")
.withKeyType(KeyType.RANGE));
我在想如果排序鍵時間戳是造成這個問題。我是否需要指定> 0以外的時間戳?