-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: BSON
https://github.com/mongodb/js-bson/pull/322
You can get some nasty surprises when you pass a string to the Decimal128 constructor:
const bson = require('bson'); const v = new bson.Decimal128('14.92'); // {"$numberDecimal":"8.740930561E-6167"} console.log(JSON.stringify(v));
Would be handy to at least throw an error. Although is there some reason why we can't just do fromString() if the user passes a string instead of a buffer to the Decimal128 constructor?