我试过
db.orders.insert({"Price":NumberDecimal("12.34")})
它抛出这个错误
Node.js 中的“ReferenceError: NumberDecimal is not defined”
但它在 robo3T 中运行良好
db.getCollection('orders').insert({"Price":NumberDecimal("12.34")})
MongoDB 外壳版本:v3.4.7
MongoDB服务器版本:3.4.7
最佳答案
将 NumberDecimal("12.34")
替换为 mongodb.Decimal128.fromString('12.34')
关于javascript - 引用错误 : NumberDecimal is not defined in mongoDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48645663/