Which one better `Double VS Decimal` in Mongo?

I base on Financial System.

Which one better 1 VS 2 :

1- Use mongo-decimal to store Mongo data as NumberDecimal

2- Use as normal Double , but we convert Double to Decimal by $toDecimal in Query Data

    addFields: { amountDbl: {$toDecimal: '$amount'}}
    $group:{_id: null, totalAmount: { $sum: "amountDbl"}}
    $project: {total: {$toDouble: '$total'}}

Converting between number types is almost certainly going to lead to trouble.

I suggest you read the MongoDB recommendations for working with monetary data.


Very thanks @robfallows.
I will check soon

Or crate the new field for Decimal Type???

Collection = {
  amount : {type : Number},
  amountDbl: ............... // Auto create

(Sorry my english not good)

Sorry. I’m not sure what you’re asking.

Thanks again, I will try read again.

Now I try to use Decimal type in Mongo.
(mongo-decimal package)

If you can have a fractional quantity of something, monetary prices should be specified using the mongo decimal format.

HI all, now I have problem when fetching data with Aggregate.
1- Meteor collection

let data = Collection.find, findOne 
// Work fine with Decimal JS Method (Client/Server)

2- Use sakulstra:aggregate or Native node driver

let data = Collection.aggregate([.......]), Collection.rawCollection().aggregate([.....]) 
// Don't work with Decimal JS Method (Client/Server)

Please help me…

Please don’t double-post. I’ve already provided an answer to this: