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

fromjson modifies input int type to float

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 1.1.4
    • None
    • Internal Client
    • None
    • Tested on Mac OS X

    Description

      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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: