| layout | api-command | ||||
|---|---|---|---|---|---|
| language | Java | ||||
| permalink | api/java/pathspec/ | ||||
| command | pathspec | ||||
| related_commands |
|
||||
| py | false | ||||
| js | false | ||||
| rb | false |
{% apibody %} r.pathspec(key[, keys...], value) → object {% endapibody %}
Creates an object with the multiple keys as a stacked structure, where the keys must
be strings. r.pathspec(A, B, C, D) is equivalent to
r.expr({ A: { B: { C: D } } }).
Example: Create a stacked structure.
r.pathspec("x", "y", "z", "bar")
// Result:
{ "x": { "y": { "z": "bar" } }}Example: Filter table by a really deep structure.
r.table("match_victories").filter(
r.pathspec("stats", "blue_team", "points", 10)
)
// Filter argument:
{ "stats": { "blue_team": { "points": 10 } } }Example: Filter table by a structure that is deep both in depth and breadth.
r.table("shows").filter(
r.pathspec("available_on", r.object(
"broadcast", r.pathspec("global", "ESPN"),
"online", r.pathspec("free", "YouTube")
))
)
// Filter argument:
{ "available_on": { "broadcast": { "global": "ESPN" }, "online": { "free": "YouTube" } } }