Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-309

fromjson modifies input int type to float

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.1.4
    • Affects Version/s: None
    • Component/s: Internal Client
    • None
    • Environment:
      Tested on Mac OS X

      Using the following C++ code the input document containing int type has been modified to float.

      void insert(const string& host, const string& collection, const
      string& json)

      { DBClientConnection c; c.connect(host); //"192.168.58.1"); BSONObj bobj = fromjson(json); c.insert(collection, bobj); }

      For example supplying json string "

      {\"test\":1}

      " the resulting
      document in mongo is

      {"test": 1.0, "_id": "4ab936711725f62f42b01b44"}

      This creates inconsistency and can lead to problem in applications who may check the types of values. It would be nice to fix it.
      Thank you,
      Valentin

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            vkuznet Valentin Kuznetsov
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: