DynamoDB:两个文档路径重叠;必须删除或重写其中一个路径。

10
我有这个更新表达式:
{
  "UpdateExpression": "SET #location = :location, #edited = :edited, #coordinates = :coordinates, #city = :city, #country = :country, #zipCode = :zipCode, #street = :street, coordinates = :coordinates",
  "ExpressionAttributeValues": {
    ":location": "Reston, VA",
    ":edited": true,
    ":coordinates": {
      "lat": 38.9586307,
      "lng": -77.35700279999999
    },
    ":city": "Reston",
    ":country": "US",
    ":zipCode": "20190",
    ":street": "11910 Market St"
  },
  "ExpressionAttributeNames": {
    "#location": "location",
    "#edited": "edited",
    "#coordinates": "coordinates",
    "#city": "city",
    "#country": "country",
    "#zipCode": "zipCode",
    "#street": "street"
  }
}

我遇到了一个奇怪的错误

ERROR: ValidationException: Invalid UpdateExpression: Two document paths overlap with each other; must remove or rewrite one of these paths; path one: [coordinates], path two: [zipCode]

我在网上找不到任何信息,也看不出重叠的地方。 如果有帮助,将不胜感激。

1个回答

10

coordinates 在你的表达式中实际上出现了两次。


3
很显然我没注意到它。这个错误有误导性,因为它提到了[邮政编码],让我看错了原因。谢谢。 - super7egazi
我同意,这很误导人。不确定为什么会有zipCode这个东西。 - Jason Wadsworth
在我的情况下,它还会抱怨路径二上的错误属性,而路径一是重复的。 - MandoMando

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接