orientDB 映射键列表

orientDB list of map keys

我通过以下方式 Java 创建了一个嵌入式地图槽:

Map<String,Object> mapObjectToInsert = new HashMap<String, Object>();
    mapObjectToInsert.put("attr1",1);
    mapObjectToInsert.put("attr2","bla");

    ODocument doc = new ODocument("testClass");
    doc.field("postUrl","11");
    doc.field("jsonData",mapObjectToInsert);
    doc.save();

现在我有以下嵌入式地图:

{
"result": [
    {
        "@type": "d",
        "@rid": "#14:0",
        "@version": 1,
        "@class": "testClass",
        "postUrl": "11",
        "postCategory": "#13:37",
        "postDateImported": "2015-04-28 15:10:38",
        "isBusniess": false,
        "isPaid": false,
        "postDateRead": "2015-04-28 15:10:33",
        "jsonData": {
            "attr1":"1"
            "attr2":"bla"            
        },
        "@fieldTypes": "postCategory=x,postDateImported=t,postDateRead=t"
    }
],
"notification": "Query executed in 0.166 sec. Returned 1 record(s)"

}

我发现

select expand(jsonData) from testClass

给出以下(地图的):

{
"result": [
    {
        "@type": "d",
        "@version": 0,
        "value": "1"
    },
    {
        "@type": "d",
        "@version": 0,
        "value": "bla"
    }
],
"notification": "Query executed in 0.159 sec. Returned 2 record(s)"

}

但我希望能够从 jsonData(attr1 和 attr2)中获取 keys 名称 这样做的方法是什么? 谢谢!

你试过了吗?

select jsonData.keys() from testClass