jsonorientdborientdb-2.1

Expand the linked list column in OrientDb


Using Orient db 2.1.12(DocumentDB) version.Facing issues in expanding the linked list column . Result of my orientdb query :

{
    "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 is a property of linked list with values as rid of another class.The query used to obtain the above result select * from testSuite Expected output :

{
    "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)"
}

Need to Expand the rid present in the list. Tired select testSuiteName,testingType,Expand(testCaseLink) from testSuite where testSuiteName='web'

But the query expands only the testCaseLink.Note:testCaseLink contains rid of different class


Solution

  • You could use

    select from testSuite FETCHPLAN *:1
    

    Check documentation for more information.

    Hope it helps.