Skip to content

Latest commit

 

History

History
60 lines (45 loc) · 1.18 KB

File metadata and controls

60 lines (45 loc) · 1.18 KB
layout language permalink command related_commands py js rb
api-command
Java
api/java/pathspec/
pathspec
object filter
object/
filter/
false
false
false

Command syntax

{% apibody %} r.pathspec(key[, keys...], value) → object {% endapibody %}

Description

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" } } }