在 OrientDB 的嵌入式类型中插入嵌入式类型
INSERT embedded types inside embedded types on OrientDB
我是 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 上创建一个嵌入类型。
我创建了 3 个 class(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
希望对您有所帮助。
我是 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 上创建一个嵌入类型。
我创建了 3 个 class(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
希望对您有所帮助。