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

bson_as_json prints insignificant digits for doubles

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: 1.10.0
    • Component/s: libbson
    • Labels:
      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

            Assignee:
            Unassigned
            Reporter:
            Jeroenooms Jeroen Ooms [X] (Inactive)
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: