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

Incorrect binary data Decimal128.fromString

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • bson-4.5.2
    • Affects Version/s: bson-4.0.2
    • Component/s: None
    • Not Needed

      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:
            alexander.golin@mongodb.com Alexander Golin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: