1

I stumbled upon an issue using MongoDB. I cannot save data with arbitrary precision and use aggregation as I intend it to do. I use price amounts and exchange rate fields.
MongoDB (documentation) suggests workarounds that won't work for me or are not satisfying my requirements.

In my case, MongoDB suggests storing the numbers as strings. The problem is that I cannot use aggregation on those fields and I have to do that programmatically, which is inefficient I think.

Do you know of a free NoSQL database that supports number fields similar to what we know from classical RDBMS systems (numbers with precision and scale) so that I can apply aggregate functions on them similar to a select count(1) from table;

It does not have to a transaction database (i.e. ACID compliant). All I wish to have is arbitrary precision and the functionality to apply aggregate functions on it.

11
  • Forgive me my ignorance, but why do you need arbitrary precision for exchange rates, which are generally just stored with a maximum of 6 decimal digits (which are well within the precision offered by MongoDB)? And that is for interbank FOREX, iirc. For consumers, the precision is usually 4 decimal places. Mar 31 '16 at 11:47
  • I thought when doing calculations (as they happen in aggregation functions) it would be good to have arbitrary precision instead of floating point arithmetic as that is not exact.
    – user19758
    Mar 31 '16 at 16:12
  • I do not know your exact use cases, of course, but imho, you do not need arbitrary precision. IB FOREX precision should be well enough for any application ;) Mar 31 '16 at 17:23
  • That would certainly be fine for me. Any accepted precision respected by the financial industry is OK. MongoDB provides only floating point precision, which is unacceptable.
    – user19758
    Mar 31 '16 at 17:38
  • Erm, iirc a 64bit floating point is precise to the 15th decimal place... Mar 31 '16 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy