Amazon dynamodb 使用ValueMap中的参数作为索引时,UpdateExpression无效(删除myArray[:index])

Amazon dynamodb 使用ValueMap中的参数作为索引时,UpdateExpression无效(删除myArray[:index]),amazon-dynamodb,Amazon Dynamodb,我尝试从数组中删除一个元素。这次手术 UpdateItemSpec updateItemSpec = new UpdateItemSpec() .withPrimaryKey("id", id) .withNameMap(new NameMap().with("#P", "myArray")) .withValueMap(new ValueMap().withInt(":index", index))

我尝试从数组中删除一个元素。这次手术

UpdateItemSpec updateItemSpec = new UpdateItemSpec()
            .withPrimaryKey("id", id)
            .withNameMap(new NameMap().with("#P", "myArray"))
            .withValueMap(new ValueMap().withInt(":index", index))
            .withUpdateExpression("REMOVE #P[:index]");

    table.updateItem(updateItemSpec);
com.amazonaws.services.dynamodbv2.model.amazondynamodexception的结果:UpdateExpression无效:语法错误;标记:“:index”,靠近:“[:index]”

如果我删除ValueMap和concat字符串,比如下面的
“remove#p[“+index+”]”
,效果很好,但这个解决方案看起来很难看(就像旧的糟糕的SQL注入东西)。有没有办法提供索引作为参数

删除-从项目中删除一个或多个属性

REMOVE(删除)
UpdateExpression
应仅具有用于删除的属性名称。它不应包含类似于
集的属性值

除了通过某种方式进行字符串连接之外,没有其他选择