bson_as_json prints insignificant digits for doubles

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Minor - P4
    • 1.10.0
    • Affects Version/s: None
    • Component/s: libbson
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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 }
      

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

                Created:
                Updated:
                Resolved: