dargolith
dargolith

Reputation: 311

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.

Upvotes: 0

Views: 92

Answers (1)

Michela Bonizzi
Michela Bonizzi

Reputation: 2632

I create this schema to try your case:

enter image description here

try this query:

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

this is the output:

enter image description here

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

enter image description here

Hope it helps.

Upvotes: 1

Related Questions