a buffer containing the raw Decimal128 bytes in little endian order, or a string representation as returned by .toString()
Readonly
bytesStatic
Private
_fromPrints a human-readable string of BSON value information If invoked manually without node.js.inspect function, this will default to a modified JSON.stringify
Optional
depth: numberOptional
options: unknownOptional
inspect: InspectFnStatic
fromCreate a Decimal128 instance from a string representation
a numeric string representation.
Static
fromCreate a Decimal128 instance from a string representation, allowing for rounding to 34 significant digits
a numeric string representation.
Example of a number that will be rounded
> let d = Decimal128.fromString('37.499999999999999196428571428571375')
Uncaught:
BSONError: "37.499999999999999196428571428571375" is not a valid Decimal128 string - inexact rounding
at invalidErr (/home/wajames/js-bson/lib/bson.cjs:1402:11)
at Decimal128.fromStringInternal (/home/wajames/js-bson/lib/bson.cjs:1633:25)
at Decimal128.fromString (/home/wajames/js-bson/lib/bson.cjs:1424:27)
> d = Decimal128.fromStringWithRounding('37.499999999999999196428571428571375')
new Decimal128("37.49999999999999919642857142857138")
Generated using TypeDoc
A class representation of the BSON Decimal128 type.