I defined the schema and go structure as follows:
const DNODE_SCHEMA = `
name: string @index(exact) .
downstream: [uid] @reverse @count .
deployment: string @index(exact) .
count_l4: int .
count_l7: int .
sum_latency_ms: float .
since: datetime .
active: bool .
reserve: bool .
type: string .
type Pod {
name
deployment
downstream
count_l4
count_l7
sum_latency_ms
since
active
reserve
}
`
type Pod struct {
Uid string `json:"uid,omitempty"`
Name string `json:"name,omitempty"`
DownStream []Pod `json:"downstream,omitempty"`
Deployment string `json:"deployment,omitempty"`
CountL4 int `json:"downstream|count_l4,omitempty"`
CountL7 int `json:"downstream|count_l7,omitempty"`
SumLatencyMs float64 `json:"downstream|sum_latency_ms,omitempty"`
Since time.Time `json:"downstream|since,omitempty"`
Active bool `json:"downstream|active,omitempty"`
Reserve bool `json:"downstream|reserve,omitempty"`
}
But when I query the nodes recursively, some facets become of type Object
:
# query
{
pod(func: has(name)) @recurse(depth: 10) {
uid
name
downstream @facets
}
}
# result
{
"uid": "0xc6",
"name": "carts-77c79d8f5c-tn4dn",
"downstream": [
{
"uid": "0xc1",
"name": "orders-b54f99dcf-n2pqj",
"downstream|active": {
"0": true
},
"downstream|reserve": true,
...
"downstream|count_l7": {
"1": 1,
"2": 1,
"3": 1,
"4": 1
}
},
{
"uid": "0xc9",
...
"downstream|since": "2022-09-14T13:42:01.235293866Z",
"downstream|active": {
"3": true
},
"downstream|sum_latency_ms": 154.48845
}
]
}
Question
Why do these non-object types become object types, and what do the keys (eg. β1β, β2β, β4β) in them mean?
How can I avoid this situation and keep the original type when querying recursively?
Other Information
The information on each edge is re-written many times.
When a facet is written, both nodes of an edge may be the starting point.
The edges are all bidirectional, , and it looks like this: