简体   繁体   中英

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).

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.

V1 ----Provides----> V2

I want to query for whole V1 but add V2's id property as provider.

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:

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

在此处输入图片说明

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