-
Hi all, {
"id": 123, #HashKey
"category": "example",
"houses": [
{
"id": 1
"name": "Joe"
"dogs": [
{
"id": 123
"name": "Markus"
},
{
"id": 890
"name": "Markus"
}
]
},
{
"id": 2
"name": "Hellen"
"dogs": [
{
"id": 456
"name": "Foofy"
}
]
},
]
} I can easily get the main object using the hash-key "123" but then I would like to retrieve and return just the list of the dogs inside the house identified by the id "1". Is there a way or it's impossible ? If the response will be the second case, which might be the right approach? Using Array.filter() on "houses" array on nodejs backend application? If is there something unclear or wrong let me know and I will correct/explain asap. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
What you are asking is not possible today. In your backend, you can filter down the This is why using paths in the current
When the generated command should be something like this
What should be the next step here? How do we move this forward from the question to a feature request? |
Beta Was this translation helpful? Give feedback.
-
Closing as a duplicate of #1589 to keep everything in one place. |
Beta Was this translation helpful? Give feedback.
What you are asking is not possible today. In your backend, you can filter down the
houses
list usingArray.filter()
if you still want a list orArray.find()
if you only want to get one item. It is also worth mentioning that theProjectionExpression
itself only allows you to specify a path and not a condition like getting the house with id=2 from the list. Unless your list is saved in the right order every time otherwise you will always need to fetch the whole list anyways and do the filtering in your backend.This is why using paths in the current
attributes
option does not work. All attribute names included inProjectionExpression
are escaped through theExpressionAttributeNames
option.…