Data type for money


(TW) #1

Is it safe to use float for storing money? Or is there any equivalent of Java’s BigDecimal?


(Michel Conrado) #2

Yes, but What worries you? (update: Actually technically I was wrong to say that. Isn’t totally safe)

No, but there’s discussion about it.


(TW) #3

I come from Java/MySQL, and usually it’s bad idea to story money value in floating point for reasons mentioned in e.g. https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency and https://stackoverflow.com/questions/2251290/storing-money-amounts-in-mysql

Do you think it’s different in Dgraph?


(Manish R Jain) #4

Dgraph should support BigInts. There should be an issue for it. If not, feel free to file one. CC: @francesc.


(Michel Conrado) #5

Actually this issue is already there. Anyone interested in this feature please show your support there.
Add more arguments to corroborate and also, give some nice thumbs up :+1: