Currently I have 3 classes in my Schema; User
, Thread
and IsMember
.
Threads can have a edge to Users called IsMember meaning they belong in that Thread (chat app).
I would like to have all the threads a User belongs to. This is easily accomplished by using the following query:
select EXPAND(IN('IsMember')) from <@rid> limit -1
However this results in a array with Threads that have a reference to the IsMember edges in the OUT_IsMember
offset. Instead of this I would like to have the User
objects inserted in the Thread
objects. Like this:
[
{
class: "Thread",
users: [
{
class: "User"
},
{
class: "User"
}
]
}
]
Since there are a lot of records using a Traverse like;
traverse OUT('IsMember') from (select EXPAND(IN('IsMember')) from <@rid>)
simply wouldn't cut it since I would have to loop through the Threads/Users to map them which would take too long.
Since I am writing in PHP I am using the official driver https://github.com/Ostico/PhpOrient with this driver the Bag stays empty so the following query also wouldn't work;
select EXPAND(IN('IsMember')) from 12:589 fetchplan out_IsMember:2
If you want to extract the users that are connected to a thread, which is connected to a given user, you can use
SELECT expand(IN('IsMember').out("IsMember")) FROM <@rid>