type:
type IdNode {
idval: string
idtype: string
ts: int
conn: [IdNode]
}
idval: string @index(exact) .
data:
{
set {
_:uuid1 <idval> "uuid1" .
_:uuid1 <idval> "uuid" .
_:uuid1 <dgraph.type> "IdNode" .
_:uuid1 <ts> "12313223211" .
_:uuid1 <conn> _:gm1 .
_:gm1 <idval> "mygmail.com" .
_:gm1 <idtype> "gmail" .
_:gm1 <dgraph.type> "IdNode" .
_:gm1 <ts> "12313223213" .
_:uuid2 <idval> "uuid2" .
_:uuid2 <idtype> "uuid" .
_:uuid2 <dgraph.type> "IdNode" .
_:uuid2 <ts> "12313223212" .
_:uuid2 <conn> _:gm1 .
_:uuid3 <idval> "uuid3" .
_:uuid3 <idtype> "uuid" .
_:uuid3 <dgraph.type> "IdNode" .
_:uuid3 <ts> "12313223212" .
_:uuid3 <conn> _:uuid2 .
_:eid <idval> "eid" .
_:eid <idtype> "eid" .
_:eid <dgraph.type> "IdNode" .
_:eid <ts> "12313223212" .
_:eid <conn> _:uuid1 .
_:fb <idval> "fb.com" .
_:fb <idtype> "fb" .
_:fb <dgraph.type> "IdNode" .
_:fb <ts> "12313223212" .
_:fb <conn> _:uuid1 .
}
}
I want to return a list of nodes from any other node in the graph, the relationship doesn’t matter here.
query:
{
find_many(func: uid("0x2719")) @recurse{
uid
idval
idtype
ts
conn
~conn
}
}
But the above query returns a nested structure. Is there any so that it will return a flattened structure like below. I know this is possible through a graph traversal logic, but just wondering is there builtin function provided by dgraph or the golang client to flatten the result.
[
{ "uid": "0x2717",
"idval": "uuid1",
"idtype": "uuid",
"ts": 12313223211
},{..}
]