Not able to search on nested property in DynamoDB

2020-08-09 07:47发布

Is it possible to search on nested properties from AWS DynamoDB console? I am able to search on all top level properties, but search on any nested properties always results in empty result set.

For example for the document provided below I am able to scan and add filter on any top level field, like id, name, etc.

However I am unable to scan, and filter on device. I am trying the filter as device.name = 'Xaomi'

{ id: 'jhfdgu75457y8r', name: 'Parag', device: {name: 'Xaomi', country: 'China'} }

Please note that I am doing this from AWS console, and not any client library. Does AWS console allows filters on nested objects?

2条回答
老娘就宠你
2楼-- · 2020-08-09 08:34

In the Filter type "device" and not device.name and select "Contains" instead of "=" in the drop-down

查看更多
聊天终结者
3楼-- · 2020-08-09 08:35

All data in DynamoDB is stored as either a string, binary or number.

When you use an SDK to access DynamoDB it will typically convert and unconvert these primatives into complex data types such as lists and maps.

The console works only on the primative data types. In this case your device attribute is treated as a string, and you cannot therefore filter by the device.name nested attribute.

You can however simply do a string filter. For example filter on the device attribute, using the contains operator and the value "name":"Xaomi"

查看更多
登录 后发表回答