我需要通过位于一列中的子字段JSON扫描表。不幸的是,我无法在Java中找到任何地方的例子,也不知道它是否可能。DynamoDB高级扫描 - JAVA
这是我的数据,这个json表示对象 - dynamodb中的一行。 JSON的代表3 Java类: - 包含级城市和一些串记录 主类 - 城市包含一类道路
是否可以扫描数据库,并找到mainName =“XYZ”的记录,已经被称为 “罗金厄姆”
{
"Id": "9",
"mainName": "xyz",
"floatVariable": 228.3,
"city": [
{
"name": "Rockingham",
"road": [
{
"roadName": "Traci",
"roadLength": 118
},
{
"roadName": "Watkins",
"roadLength": 30
}
]
}
],
“房子” 一个城市的记录:{ “huseName”: “温迪·卡森” }}
我有一些像这样,这工作,但这个为n不足以查询正确的数据。 Table table = dynamoDB.getTable(tableName);
Map<String, Object> expressionAttributeValues = new HashMap<String, Object>();
expressionAttributeValues.put(":pr", 300);
ItemCollection<ScanOutcome> 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<Item> iterator = items.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next().toJSONPretty());
}
我在php中看到了一个这样的例子,但不幸的是它在Java中不起作用。
ItemCollection<ScanOutcome> items = table.scan(
" cites.name = :dupa ", //FilterExpression
"Id, mainName, floatVariable, city", //ProjectionExpression
null, //ExpressionAttributeNames - not used in this example
expressionAttributeValues);
“cites.name =:DUPA”,// FilterExpression我想写“city.name” – Wojciech 2015-04-02 10:44:38