sequence.bracket(attr) → sequence singleSelection.bracket(attr) → value object.bracket(attr) → value array.bracket(index) → value
Get a single field from an object. If called on a sequence, gets that field from every object in the sequence, skipping objects that lack it.
Under most circumstances, you’ll want to use getField (or its shorthand
g) or nth rather than
bracketterm may be useful in situations where you are unsure of the data type returned by the term you are calling
Example: What was Iron Man’s first appearance in a comic?
r.table("marvel").get("IronMan").bracket("firstAppearance").run(conn); // more idiomatically: r.table("marvel").get("IronMan").g("firstAppearance").run(conn);
bracket command also accepts integer arguments as array offsets, like the nth command.
Example: Get the fourth element in a sequence. (The first element is position
0, so the fourth element is position
r.expr(r.array(10, 20, 30, 40, 50)).bracket(3).run(conn); // more idiomatically: r.expr(r.array(10, 20, 30, 40, 50)).nth(3).run(conn); 40
Couldn't find what you were looking for?
© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.