简体   繁体   中英

Orientdb query child

Is there a way with Orientdb 2.1.11 (document database) to get the EmebeddedList

Here is the class structure

{
    "@class":"Quote",
    "number":"Q1",
    "details":[{
      "code":"123",
      "price":10
      },{
      "code":"456",
      "price":20
      }
    ]
},{
    "@class":"Quote",
    "number":"Q2",
    "details":[{
      "code":"789",
      "price":15
      },{
      "code":"951",
      "price":25
      }
    ]
}

I would like a query that will return the following :

number| code | price
------|------|------
Q1    | 123  | 10
Q1    | 456  | 20
Q2    | 789  | 15
Q2    | 951  | 25

I have replicated your structure

在此处输入图片说明

and I have used this query

select number, details.code as code, details.price as price from (select prop.number as number, prop.details as details from (select prop from test unwind prop) unwind details)

在此处输入图片说明

Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM