+

ReQL command: +

Command syntax

value + value → value
time + number → time
value.add(value[, value, ...]) → value
time.add(number[, number, ...]) → time

Description

Sum two or more numbers, or concatenate two or more strings or arrays.

The add command can be called in either prefix or infix form; both forms are equivalent. Note that ReQL will not perform type coercion. You cannot, for example, add a string and a number together.

Example: It’s as easy as 2 + 2 = 4.

> (r.expr(2) + 2).run(conn)

4

Example: Concatenate strings.

> (r.expr("foo") + "bar" + "baz").run(conn)

"foobarbaz"

Example: Concatenate arrays.

登录查看完整内容