Back to top

ReQL command: round

Command syntax

r.round(number) → number

number.round() → number


Rounds the given value to the nearest whole integer.

For example, values of 1.0 up to but not including 1.5 will return 1.0, similar to floor; values of 1.5 up to 2.0 will return 2.0, similar to ceil.

Example: Round 12.345 to the nearest integer.

r.round(12.345).run(conn, callback);
// Result passed to callback

The round command can also be chained after an expression.

Example: Round -12.345 to the nearest integer.

r.expr(-12.345).round().run(conn, callback);
// Result passed to callback

Example: Return Iron Man’s weight, rounded to the nearest integer.

r.table('superheroes').get('ironman')('weight').round().run(conn, callback);

Get more help

Couldn't find what you were looking for?