当我尝试进行条件更新时出现以下错误:
无效的ConditionExpression:语法错误;令牌:“-”,附近:“ PageRouteee1181aa-8035”
我有以下课程:
public class RestaurantPageRouteItem
{
[DynamoDBHashKey]
public string PageRoute { get; set; }
public string RestaurantId { get; set; }
}
然后我创建以下表达式:
new Expression
{
ExpressionStatement = $"attribute_not_exists({item.PageRoute}) OR {item.RestaurantId} = :restaurantid",
ExpressionAttributeValues =
{
[":restaurantid"] = item.RestaurantId
}
}
答案 0 :(得分:0)
设法提出以下建议:
new Expression {
ExpressionStatement =
"(attribute_not_exists(#ID) OR :id = #ID) OR " +
"(attribute_not_exists(PageRoute))",
ExpressionAttributeValues = {
[":id"] = item.RestaurantId
},
ExpressionAttributeNames = {
["#ID"] = "RestaurantId"
}
}