展开OrientDb

时间:2017-01-10 10:19:48

标签: json orientdb orientdb-2.1

使用Orient db 2.1.12(DocumentDB)version.Facing扩展链表列时出现问题。 我的orientdb查询的结果:

{
    "result": [
        {
            "@type": "d",
            "@rid": "#28:0",
            "@version": 7,
            "@class": "testSuite",
            "testSuiteName": "web",
            "testCaseLink": [
                "#20:0",
                "#20:1",
                "#20:2",
                "#20:3",
                "#20:4",
                "#20:5"
            ],
            "testingType": "Web",
            "@fieldTypes": "testCaseLink=z"
        }
    ],
    "notification": "Query executed in 0.061 sec. Returned 1 record(s)"
}

testCaseLink是链表的属性,其值为去掉另一个类。用于获取上述结果的查询 select * from testSuite 预期产出:

{
    "result": [
        {
            "@type": "d",
            "@rid": "#28:0",
            "@version": 7,
            "@class": "testSuite",
            "testSuiteName": "web",
            "testCaseLink": [
                {
                    "@type": "d",
                    "@rid": "#20:0",
                    "@version": 5,
                    "@class": "testCase",
                    "name": "testForBAsu",
                    "uiJson": "#18:0",
                    "testcaseType": "webWithCsv",
                    "isEdited": false,
                    "isDeleted": false,
                    "childtestCaseLink": [
                        "#20:3",
                        "#20:4"
                    ],
                    "@fieldTypes": "uiJson=x,childtestCaseLink=z"
                },
                {
                    "@type": "d",
                    "@rid": "#20:1",
                    "@version": 6,
                    "@class": "testCase",
                    "name": "success",
                    "uiJson": "#18:1",
                    "testcaseType": "WebWithoutCsv",
                    "isEdited": true,
                    "isDeleted": false,
                    "eeJson": "#19:0",
                    "parentTestCaseLink": null,
                    "@fieldTypes": "uiJson=x,eeJson=x,parentTestCaseLink=x"
                },
                "#20:2",
                "#20:3",
                "#20:4",
                "#20:5"
            ],
            "testingType": "Web",
            "@fieldTypes": "testCaseLink=z"
        }
    ],
    "notification": "Query executed in 0.061 sec. Returned 1 record(s)"
}

需要展开列表中的rid。 累了从testSuite中选择testSuiteName,testingType,Expand(testCaseLink),其中testSuiteName =' web'

但是查询只扩展了testCaseLink.Note:testCaseLink包含了不同的类

2 个答案:

答案 0 :(得分:1)

您可以使用

select from testSuite FETCHPLAN *:1

查看documentation了解详情。

希望它有所帮助。

答案 1 :(得分:0)

从testSuite FETCHPLAN中选择*:1