Back to top

ReQL command: optArg

Command syntax

term.optArg(option, value)

Description

Specify an optional argument to a Java ReQL term.

Some terms in ReQL accept optional arguments. Since Java doesn’t support named arguments, the RethinkDB Java driver allows you to pass them by chaining the optArg command after them.

Example: Pass the right_bound optional argument to between.

r.table("marvel").between(10, 20).optArg("right_bound", "closed").run(conn);

To pass more than one optional argument, chain optArg once for each argument.

Example: Pass the right_bound and index optional arguments to between.

r.table("marvel").between(10, 20).optArg("right_bound", "closed")
 .optArg("index", "power").run(conn);

Get more help

Couldn't find what you were looking for?