0
Record1: [{
"business_id": 2,
"forms": {
    "f522": {
        "id": "f522",
        "is_deleted": 0,
        "title": "Form 1"
        },
    "f8b6": {
        "id": "f8b6",
        "is_deleted": 0,
        "title": "Form 2" 
       },
    "fw56": {
        "id": "fw56",
        "is_deleted": 0,
        "title": "Form 3" 
      }
}
}]

Record2: [{
"business_id": 3,
"forms": {
    "f788": {
        "id": "f788",
        "is_deleted": 0,
        "title": "Form 11"
    },
    "f6yy": {
        "id": "f6yy",
        "is_deleted": 0,
        "title": "Form 12"
    },
    "f00i": {
        "id": "f00i",
        "is_deleted": 0,
        "title": "Form 13"
    }
}
}]

Record3: [{
"business_id": 4,
"forms": {
    "f839": {
        "id": "f839",
        "is_deleted": 0,
        "title": "Form 21"
    },
    "f1bc": {
        "id": "f1bc",
        "is_deleted": 0,
        "title": "Form 22"
    },
    "f6ac": {
        "id": "f6ac",
        "is_deleted": 0,
        "title": "Form 23"
    }
}
}]

我有 3 条记录存储在 dynamoDB 表中。哈希键是business_id。forms 对象是带有子对象(id、is_deleted、title)的父对象。我不知道 business_id 的价值。但我只有 id 值“f6yy”。我想要使​​用子对象 id(值为 f6yy)的 business_id 的整个记录​​。请建议。

4

1 回答 1

1

下面的过滤器表达式应该可以工作。

JavaScript上的过滤器表达式:-

FilterExpression : 'forms.f6yy.id = :formIdVal',
    ExpressionAttributeValues : {           
        ':formIdVal' : 'f6yy'
    }

PHP:-

'FilterExpression' => 'forms.f6yy.id = :formIdVal',
于 2017-03-22T14:22:51.443 回答