Optional
CEILINGConstant value for ROUND_CEILING rounding mode.
Optional
DOWNConstant value for ROUND_DOWN rounding mode.
Optional
FLOORConstant value for ROUND_FLOOR rounding mode.
Optional
HALF_Constant value for ROUND_HALF_DOWN rounding mode.
Optional
HALF_Constant value for ROUND_HALF_EVEN rounding mode.
Optional
HALF_Constant value for ROUND_HALF_UP rounding mode.
Optional
UPConstant value for ROUND_UP rounding mode.
Generated using TypeDoc
Specifies constant values used for rounding modes in the number library.
Rounding mode specifies rounding behavior of numerical and/or rounding operations in the number library, specifically indicating how the least significant digit of the result should be calculated. There are several well known rounding modes. NoSQL database supports rounding modes used by Java BigDecimal and specified as RoundingMode enumeration. Also see documentation for the number library of your choice on supported rounding modes.
This object may be specified as RoundingModes property and it helps the driver determine the rounding mode constant values (which are usually Javascript numbers) for different rounding modes used by the number library. The driver uses it to infer which rounding mode is used by the library or set as roundingMode property, see NumberLibRoundingMode.
In most cases, it is not necessary to set RoundingModes and thus use this object. Specifically, this property is not necessary if:
Note that you may also set RoundingModes to string in which case it will be used as a property name or path ('.'s allowed) of constructor or module to the object containing rounding mode constants instead of checking candidate names as described above.
The properties listed correspond to each rounding mode supported by the driver. Note that some number libraries, such as big.js, support only a subset of these. In this case the driver will infer all it can. If neither RoundingModes nor roundingMode properties are set and rounding mode constants cannot be inferred, the driver will assume default rounding mode ROUND_HALF_UP.
Note that some number libraries may support rounding modes not listed here and not supported by Java BigDecimal, such as ROUND_HALF_CEIL and ROUND_HALF_FLOOR. Using of these rounding modes will result in NoSQLArgumentError.
Although numeric rounding mode values are usually used, if the library of your choice using other type for rounding mode constants you may specify them as well. Any value is allowed except undefined and null.