M
M
MonsterAndrew2018-03-24 13:40:56
MongoDB
MonsterAndrew, 2018-03-24 13:40:56

How to leave all zeros in float in MongoDB?

Good afternoon! I'm using the Robo 3T (formerly Robomongo) Mac client, but when I add a value like "x": 1.000, I get "x": 1.0. Is there any way to disable this feature by removing zeros? Does this happen in MongoDB or does the client do it themselves? There must be at least 3 characters after the dot.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Makarov, 2018-03-24
@Nipheris

Understand that documents in Monge are stored in JSON, and in JSON your 1.0number is stored, and it is not stored at all as it is shown. To store specific formatting , you need to store a string, not a number.

L
lega, 2018-03-25
@lega

Add zeros when receiving data from mongo and that's it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question