Hi folks,
I’ve followed @robfallows advice for running Mongo 3.4 locally to use Mongo’s new NumberDecimal type. The only problem now is displaying these fields in a Blaze template. Has anyone successfully done this?
Here’s how it’s stored in my collection:
"contactScore" : NumberDecimal("0.1230739")
When I try to display this field in my template though, the browser console shows it as appearing as:
Object
_bsontype: "Decimal128"
bytes: Uint8Array[16]
__proto__: Object
I’ve tried various suggestions to decode the Uint8Array and am in the progress of testing the MongoDB Extended JSON npm package, but can’t get anything to give me back a string, much less a number. Any advice from someone else who has dealt with this?
Thanks!
Update
After installing and testing the MongoDB Extended JSON package from npm, the output from EJSON.stringify()
is {"$numberDecimal":"[object Object]"}
. Not sure what I’m doing wrong, would love some feedback. Thanks!