-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor - P4
-
Affects Version/s: None
-
Component/s: None
What problem are you facing?
The error message from improperly quoted input is misleading.
test> db.example.insertOne( { dec128: Decimal128(10) } )
TypeError: value.bytes.subarray is not a function
test> db.example.insertOne( { dec128: Decimal128("10") } )
{
acknowledged: true,
insertedId: ObjectId("61b39cdde089823cffcb4586")
}
It's not clear from the message that the value passed to Decimal128 needs to be quoted.
What driver and relevant dependency versions are you using?
Connection is to MongoDB server 5.1 using mongosh 1.1.12
Steps to reproduce?
Enter the following in mongosh:
db.example.insertOne( { dec128: Decimal128(10) } )
Note: I discussed this with the mongosh team who said the error message is returned by the node driver.