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

Incorrect binary data Decimal128.fromString (bson-ext)

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: bson-ext-4.0.0
    • Component/s: EJSON
    • Not Needed

      This issue was originally reported for js-bson but is also present for bson-ext. The js-bson fix should apply to bson-ext, but we should double check and add the appropriate tests.
      ---------
      https://github.com/mongodb/js-bson/issues/334

      Hello. Decimal128.fromString is working incorrect, you can reproduce bug using negative numbers of pattern 0.00XX :

      bson.Decimal128.fromString('-0.0097').toString() // -0.0000
      bson.Decimal128.fromString('-0.0011').toString() // -0.0000
      

      Same numbers, but with different zero count will work:

      bson.Decimal128.fromString('-0.00970').toString() // -0.00970
      bson.Decimal128.fromString('-0.00110').toString() // -0.00110
      bson.Decimal128.fromString('-0.00010').toString() // -0.00110
      

      bson package version is 4.0.2

            Assignee:
            daria.pardue@mongodb.com Daria Pardue
            Reporter:
            daria.pardue@mongodb.com Daria Pardue
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: