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"
    }
}
}]

I have 3 records stored in dynamoDB table. Hash Key is business_id. forms object is parent object with child objects(id, is_deleted, title). I don't know business_id value. But i have only id value "f6yy". I want whole records with business_id using child object id(value is f6yy). Please suggest.

1 Answer 1

1

The below filter expression should work.

Filter expression on JavaScript:-

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

PHP:-

'FilterExpression' => 'forms.f6yy.id = :formIdVal',
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.