我需要通过子字段JSON扫描表,它位于一列中 . 不幸的是,我无法在Java中找到任何示例,也不知道是否可能 .
这是我的数据,这个json代表对象 - 在dynamodb中有一行 . json代表3个java类: - 包含类城市的主类和一些字符串记录 - 城市包含类路
是否可以扫描数据库并找到mainName =“xyz”的记录并拥有一个名为“Rockingham”的城市记录
{
"Id": "9",
"mainName": "xyz",
"floatVariable": 228.3,
"city": [
{
"name": "Rockingham",
"road": [
{
"roadName": "Traci",
"roadLength": 118
},
{
"roadName": "Watkins",
"roadLength": 30
}
]
}
],
“house”:{“huseName”:“Wendy Carson”}}
我有一些这样的和这项工作,但这还不足以查询正确的数据 . 表table = dynamoDB.getTable(tableName);
Map expressionAttributeValues = new HashMap();
expressionAttributeValues.put(":pr", 300);
ItemCollection items = table.scan(
"floatVariable < :pr", //FilterExpression
"Id, mainName, floatVariable, city" , //ProjectionExpression
null, //ExpressionAttributeNames - not used in this example
expressionAttributeValues);
System.out.println("Scan of " + tableName + " for items with a price less than 300.");
Iterator iterator = items.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next().toJSONPretty());
}
我在php中看到了一个像这样的例子,但不幸的是它在Java中不起作用 .
ItemCollection items = table.scan(
" cites.name = :dupa ", //FilterExpression
"Id, mainName, floatVariable, city", //ProjectionExpression
null, //ExpressionAttributeNames - not used in this example
expressionAttributeValues);