我有一个相当嵌套的对象结构,我想在dynamodb中扫描。它看起来像这样:
ProductGroup
| id
| customerId
| serviceId
| [assignedAssets] (An Array of Assets objects, each of which has the following)
| | id
| | sku
| | [instances] (an array of Instance objects, each of which has the following)
| | | id
| | | friendlyName
如果我想找到包含ID为的实例的ProductGroup,比如" instance10",我可以使用in
和=
运算符的某种组合利用Dynamo的过滤表达式?如果它有任何区别,请使用Javascript SDK。
答案 0 :(得分:0)
如果你也知道资产ID,而不是使用数组,你可以使用地图在服务器端进行过滤。
ProductGroup
| id
| customerId
| serviceId
| {assignedAssets} (A Map of Asset objects, where the key is id)
| | id
| | sku
| | {instances} (A Map of Instance objects, where the key is the id)
| | | id
| | | friendlyName
此处,过滤器表达式为attribute_exists(assignedAssets.#assignedAssetId.instances.#instanceId)