When I store the ID it disappears with some numbers

0

I was doing an application and in it I needed to store the id that is pretty big type This was my id 173782035419103232 but when I get to the database it changes to 173782035419103230 how can I do it so it does not round the number (Use the MongoDB / Mongoose lib)

    
asked by anonymous 15.04.2017 / 22:20

1 answer

0

I can see two outputs:

  • Save your ID as String, which will make sense if you are not going to do arithmetic operations on the bank as that value (add, average ...).
  • Save your value as Decimal128 which is the data type for numbers "big" in mongodb (you need to use mongo version 3.4 to use this kind of data).
  • 17.04.2017 / 21:38