I'm new on orientdb and I would like to know if is possible to insert a document with three levels of depth, using a embedded inside another embedded, like the example under. I've being searching for some examples like my data with no success. Example:
"p_partkey": 1,
"p_name": "lace spring",
"lineorder": [{
"lo_revenue": 4282453,
"lo_orderdate": 19920603,
"customer": [{
"c_nation": "JORDAN",
"c_address": "uZaxFV8o9IGgayUEWtPU1Xmw",
"c_mktsegment": "BUILDING|"
}],
"orderdate": [{
"d_date": "June 3, 1992",
"d_datekey": 19920603,
"d_year": 1992
}]},{
"lo_revenue": 46868767,
"lo_orderdate": 9987983,
"customer": [{
"c_nation": "BRAZIL",
"c_address": "kjbnkjakjh",
"c_mktsegment": "BUILDING|"
}],
"orderdate": [{
"d_date": "June 6, 1994",
"d_datekey": 19940606,
"d_year": 1994
}]}]
All examples I've found uses only one level of embedded documents. I've being using:
INSERT into part CONTENT {json data}
But it creates only one embedded type on lineorder.
I have created 3 class ( A, B, C )
I use these query :
insert into A content { "embedded_B" : { "@type":"d", "@class":"B", "name" :"myRecord_B", "embedded_C" : { "@type":"d", "@class":"C", "name" :"myRecord_C" }}}
select embedded_B.name as name,embedded_B.type() as type from A
select embedded_B.embedded_C.name as name,embedded_B.embedded_C.type() as type from A
Hope it helps.