I’ve posted this on StackOverflow as well.
I’m trying to store currency data in MongoDB using NumberDecimal()
as per the documentation suggests, however, I’m getting ReferenceError: NumberDecimal is not defined
. I’m running db version v4.2.2
and MongoDB shell version v4.2.2
within Nodejs.
What am I missing here? Is this an import problem.
const result = await client
.db('PurchaseOrders')
.collection('purchaseOrders')
.updateOne(
{ _id: ObjectId(_id) },
{
$set: { data: NumberDecimal('1.02') }
},
{
upsert: true
}
);