学会java能懂dynamo_DynamoDB高级扫描 - JAVA

我需要通过子字段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);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值