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

Cast Javascript Number as bsonType: "double"

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      How are you using Mongo? What version of the server and driver are you using?

      I'm using Mongo with Meteor. The driver version is 4.11.0.

      What is the feature/improvement you would like?

      I would like to see Numbers cast as `bsonType: double` unless explicitly cast otherwise. Basically, I think it should mirror the mongo shell default behavior:
      `The mongo shell treats all numbers as floating-point values by default` 

      This has been discussed previously here: https://jira.mongodb.org/browse/NODE-3164

      I think if an integer is desired, then that should be explicitly cast by the user in their application code.

      What use case would this feature/improvement enable?

      When trying to insert something like `1`, `1.0` or `1.00`, it will be cast as a bsonType: double.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jamauro@gmail.com J M
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: