DynamoDB [Java] - 查询嵌套的JSON文档属性值

时间:2017-09-15 09:45:59

标签: java amazon-web-services amazon-dynamodb

作为问题的标题说; DynamoDB中是否可以在嵌套的JSON文档中查询特定的属性值?我一直在寻找官方文档,SO,论坛等的答案,但是我仍然无法提供有效的查询。

Java中的实体对象示例:

@DynamoDBTable(tableName = "Car")
public class Car {
    @DynamoDBHashKey
    String id;

    String color;

    String type;

    Engine engine;
}

@DynamoDBDocument
public class Engine {
    String manufacturer;
    int hp;
    String model;
}

数据库中的记录:

{
    "id" : "43-asdasda4214ads13-13",
    "color" : "blue",
    "type" : "sedan",
    "engine" : {
        "manufacturer" : "ford",
        "hp" : 450,
        "model" : "av15"
    }
}
{
    "id" : "24ads123-adad123-das1",
    "color" : "red",
    "type" : "cabrio",
    "engine" : {
        "manufacturer" : "peugeot",
        "hp" : 130,
        "model" : "ig31-2"
    }
}

我可以查询一下engine提供ford的所有汽车吗?如果是这样,我怎么能这样做?我已经按照以下格式keyConditionExpression尝试engine.manufacturer = ford,但没有成功。我想避免使用FilterExpression

提前致谢!

0 个答案:

没有答案