Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2612

bson_as_json prints insignificant digits for doubles

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor - P4 Minor - P4
    • 1.10.0
    • None
    • libbson
    • None

    Description

      Unfortunately a new number formatting similar to issue: https://jira.mongodb.org/browse/CDRIVER-652. The bson_as_json function prints many insignificant digits for doubles:

      > con <- mongo()
      > con$insert('{"test": 3.9}')
      > con$export()
      { "_id" : { "$oid" : "5ad088a5ba7cb20ff97e6a54" }, "test" : 3.8999999999999999112 }
      

      OTOH, the mongo command line utility prints the correct number of digits for the same data:

      > db.test.find()
      { "_id" : ObjectId("5ad088a5ba7cb20ff97e6a54"), "test" : 3.9 }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Jeroenooms Jeroen Ooms [X]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: