Hi, Giulia,
Thank you! This "Raw" button is very useful for seeing the JSON output.
I didn't know about that.
Unfortunately, that does not answer my original question. I am already
able to nest the email /address/ in an array in the User object. What I
want to do is to /expand/ the email objects themselves and nest them in
an array in the User object, preferably in a single query.
In other words, if I have this:
insert into User set name = "Joe", isMale = true
insert into EmailAddress set address = "[email protected]", isSubscriber = true
insert into EmailAddress set address = "[email protected]", isSubscriber = false
create edge Owns
from (select from User where name = "Joe")
to (select from EmailAddress where address = "[email protected]")
create edge Owns
from (select from User where name = "Joe")
to (select from EmailAddress where address = "[email protected]")
This gives me a User vertex connected to two different EmailAddress
vertices via two Owns edges.
What I want is to write a single query that returns the expanded
EmailAddress objects nested in the User object:
{
"name": "Joe",
"isMale": true,
"emailAddresses": [
{
"address": "[email protected]",
"isSubscriber": true
},
{
"address": "[email protected]",
"isSubscriber": false
}
]
}
Does that make sense? Possible?
Thanks!
Chas.
On 8/17/15 8:26 PM, Giulia Brignoli wrote:
Hi,
when you execute this query in the browse in Visual Studio
|
select*,out('Owns').mail asemails,out('Owns').@ridasrid fromUser
|
simply click on spits ROW to see the result in JSON format (look the
screen)
<https://lh3.googleusercontent.com/-G26Q3HkDgkY/VdGaZcge1MI/AAAAAAAAAHs/W6bZEyFo5Lo/s1600/Immagine.png>
If you click on ROW this return some like this:
|
{
"result": [
{
"@type": "d",
"@rid": "#12:0",
"@version": 2,
"@class": "User",
"name": "Giulia",
"out_Owns": [
"#14:0"
],
"emails": [
"[email protected]"
],
"rid": [
"#13:0"
],
"@fieldTypes": "out_Owns=g,rid=z"
},
{
"@type": "d",
"@rid": "#12:1",
"@version": 2,
"@class": "User",
"name": "Alessandro",
"out_Owns": [
"#14:1"
],
"emails": [
"[email protected]"
],
"rid": [
"#13:1"
],
"@fieldTypes": "out_Owns=g,rid=z"
},
{
"@type": "d",
"@rid": "#12:2",
"@version": 2,
"@class": "User",
"name": "Luigi",
"out_Owns": [
"#14:2"
],
"emails": [
"[email protected]"
],
"rid": [
"#13:2"
],
"@fieldTypes": "out_Owns=g,rid=z"
}
],
"notification": "Query executed in 0.016 sec. Returned 3 record(s)"
}
|
Regards,
Giulia
--
---
You received this message because you are subscribed to a topic in the
Google Groups "OrientDB" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/orient-database/XgM8ccwkD1g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
[email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.