save to db as integer, but read out got float number

98 views
Skip to first unread message

Henry John

unread,
Jun 1, 2015, 6:48:34 AM6/1/15
to mongod...@googlegroups.com
Hi, all
      My MongoDB version is  2.4.9
      Here is an record:
      {
          "ClientID" : 3308442,
          "sid" : 231
      }
      all data are integers.

      but when I use pymongo (Python mongo sdk) to find this document and read its items, print out as :
sid:213.0     ClientID:3258107.0
       Why the integer fields are converted into float numbers?


Regards!




Stephen Dillon

unread,
Jun 2, 2015, 7:48:41 AM6/2/15
to mongod...@googlegroups.com

Try reading the data via the Mongo shell and see what you get. Could some change to the Python Mongo sdk, which I am completely unfamiliar with, be manifesting this as a display issue?

I had a similar thing happen using RoboMongo 8.5 and MongoDB 2.6.4. What we discovered in our scenario was that the display of the data in Robomongo was incorrect but the actual underlying value in JSON was correct.
Reply all
Reply to author
Forward
0 new messages