Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-3815

Improve error message for improper input quoting

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • bson-4.6.1
    • Affects Version/s: None
    • Component/s: None
    • 2
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • 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. 

            Assignee:
            sam.zhang@mongodb.com Sam Zhang (Inactive)
            Reporter:
            dave.cuthbert@mongodb.com Dave Cuthbert (Inactive)
            Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None