joinKeyPaths.php
Table of Contents
Functions
- joinKeyPaths() : array{0: string, 1: string, 2: string|null}
- Where the keys of a join are read in the parent document — the path an `IN` compares them with, the list they come from, and where each element of that list carries its own key.
Functions
joinKeyPaths()
Where the keys of a join are read in the parent document — the path an `IN` compares them with, the list they come from, and where each element of that list carries its own key.
joinKeyPaths(string $anchor[, null|string|array<string|int, mixed> $property = null ]) : array{0: string, 1: string, 2: string|null}
🔑 Arango::PROPERTY is appended to the anchor, and an expansion [*] splits it in
two : what comes before reaches the list, what comes after is read on each element.
A list of objects [ { _key , id } , … ] is therefore joined on '[*]._key'.
🚨 An expansion is glued to the path it expands, without a dot. key() puts a dot
between two segments, so the property '[*]._key' used to produce doc.refs.[*]._key —
an AQL syntax error on every query — and '_key' produced doc.refs._key, the attribute
of a list, which ArangoDB answers with null : nothing was ever joined, and nothing said
so. A property with no expansion keeps the path it always had.
Arango::PROPERTY |
the IN path |
the list | the element key |
|---|---|---|---|
null |
doc.refs |
doc.refs |
null |
'ids' |
doc.refs.ids |
doc.refs.ids |
null |
'[*]._key' |
doc.refs[*]._key |
doc.refs |
'_key' |
'items[*].ref' |
doc.refs.items[*].ref |
doc.refs.items |
'ref' |
A null element key means the elements ARE the keys — a list of bare keys.
⚠️ One expansion, no more. A second [*] would compare a key with a list of lists,
which never matches : it is refused rather than left to answer nothing.
Parameters
- $anchor : string
-
The AQL path of the joined field in the parent document (
doc.refs). - $property : null|string|array<string|int, mixed> = null
-
The
Arango::PROPERTYof the join definition. An array is appended as it always was, and carries no expansion.
Tags
Return values
array{0: string, 1: string, 2: string|null} —The IN path, the list path, and the key read on each
element (or null when the elements are the keys).