阅读背景:

无法在DynamoDB AWS控制台中搜索嵌套属性

来源:互联网 

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.

是否可以从AWS DynamoDB控制台搜索嵌套属性?我能够搜索所有顶级属性,但搜索任何嵌套属性总是导致空结果集。

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

例如,对于下面提供的文档,我可以在任何顶级字段上扫描和添加过滤器,例如id,name等。

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

但是我无法扫描,并在设备上进行过滤。我正在尝试过滤器as device.name ='Xaomi'

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

{id:'jhfdgu75457y8r',名称:'Parag',设备:{名称:'Xaomi',国家:'中国'}}

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

请注意,我是从AWS控制台执行此操作,而不是任何客户端库。 AWS控制台是否允许对嵌套对象进行过滤?

2 个解决方案

#1


1  

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

DynamoDB中的所有数据都存储为字符串,二进制或数字。

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.

当您使用SDK访问DynamoDB时,它通常会将这些主要内容转换并转换为复杂的数据类型,例如列表和地图。

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.

控制台仅适用于主要数据类型。在这种情况下,您的设备属性将被视为字符串,因此您无法通过device.name嵌套属性进行过滤。

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

但是,您可以简单地进行字符串过滤。例如,对device属性进行过滤,使用contains运算符和值“name”:“Xaomi”

#2


-1  

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

在过滤器类型“device”而不是device.name中,在下拉列表中选择“Contains”而不是“=”


分享到: