我是orientdb的新手,我想知道是否可以插入具有三个深度级别的文档,使用嵌入式内部另一个嵌入式,如下面的示例。我正在搜索像我的数据这样的例子但没有成功。 例如:
"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
}]}]
我发现的所有示例仅使用一级嵌入式文档。 我正在使用:
INSERT into part CONTENT {json data}
但它只在lineorder上创建一个嵌入类型。
答案 0 :(得分:1)
我创建了3个类(A,B,C)
我使用这些查询:
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
希望它有所帮助。