ReQL command: bitAnd

Command syntax

r.bitAnd(number) → number
r.bitAnd(number[, number, ...]) → number

Description

A bitwise AND is a binary operation that takes two equal-length binary representations and performs the logical AND operation on each pair of the corresponding bits, which is equivalent to multiplying them. Thus, if both bits in the compared position are 1, the bit in the resulting binary representation is 1 (1 × 1 = 1); otherwise, the result is 0 (1 × 0 = 0 and 0 × 0 = 0).

Example:

r.expr(5).bitAnd(3).run(conn);

// Result:
1

© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
https://rethinkdb.com/api/javascript/bit_and/