Handling money/currency with MongoDB
These are examples for (fictive) user input:
I need to store that in my MongoDB database. That should be quite easy, just store the string, right?
Well, no. I need to take, for example, "-$1213.12" and figure out if the amount is negative or positive and in which currency the amount is, and store it accordingly. Furthermore, I need to be able to pull out these entries later and use them for calculations. Another problem I discovered is that some countries use a dot to seperate decimal places, and some use a comma. Ruby can only handle dots.
Any suggestions, possibly?
EDIT// I solved one problem by banning currency symbols in the user input. That leaves me with the negative/positive problem and the seperator problem.
User input now may look like this: