Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1616

NaN values in MongoDB

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.3.3
    • Component/s: CRUD
    • None
    • Environment:
      linux 4.9.0, mongodb 3.6.14

      2020/05/12 23:09:12 Error with mongodb://admins.find(): error decoding key osbuilddate(field OsBuildDate): IntDecodeValue can only truncate float64 to an integer type when truncation is enabled

       

      The trouble is that some data put into mongodb from NodeJS sources, particularly when using parseInt or parseFloat before insertion, is recorded in the db as NaN.

      Therefore, when the go driver tries to pull that data out, all find() requests are halted if even a single document has a value of NaN when using Find() to write to a go struct that uses an int64 field.

      It seems to me I could rewrite the javascript stuff and just put null or nothing in the event of having a NaN value, however NaN isn't exactly nothing.

      I cannot understand the reason that the go driver would fail completely in this situation.

      Please help.

            Assignee:
            Unassigned Unassigned
            Reporter:
            andrewhodel@gmail.com Andrew Hodel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: