简体   繁体   English

OrientDB包含来自连接顶点的属性

[英]OrientDB include property from connected vertex

My Current Query: 我当前的查询:

SELECT *, in('Provides').include('id') as provider FROM #12:1

This gives the full record of #12:1 plus one more property provider (as expected). 这给出了#12:1的完整记录,再加上一个属性提供程序(按预期)。

However, provider contains: 但是,提供程序包含:

[{"@type":"d","@version":0,"id":"providerId"}]

I would like it to contain: 我希望它包含:

"providerId"

to not have to "clean up" the property, is it possible? 不必“清理”财产,这可能吗?

Background (if my approach is wrong) 背景 (如果我的方法错误)

I have 2 vertices connected by a 'Provides' edge. 我有2个通过“提供”边缘连接的顶点。

V1 ----Provides----> V2 V1 ----提供----> V2

I want to query for whole V1 but add V2's id property as provider. 我想查询整个V1,但将V2的id属性添加为提供程序。

I create this schema to try your case: 我创建此架构来尝试您的情况:

在此处输入图片说明

try this query: 试试这个查询:

SELECT *, in('Provides').id[id] as provider FROM #12:1

this is the output: 这是输出:

在此处输入图片说明

if you don't like seeing the 'providerId' between brackets you can use unwind: 如果您不希望看到方括号之间的“ providerId”,可以使用展开:

SELECT *, in('Provides').id[id] as provider FROM #12:1 unwind provider

在此处输入图片说明

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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