Problem handling large numbers (BigDecimal)


I am running the JVM with -Dcom.couchbase.json.decimalForFloat=true

I can insert a large numeric values, I can query it correctly using key access (bucket.get(“KEY1”)).
It is retrieved correctly when I use asterisk in the query.
The number is truncated when I specify the field explicitly in the query.
Please see my test case bellow:

 // Running with -Dcom.couchbase.json.decimalForFloat=true
public void testDemoTestCase() {
    final JsonDocument docToUpsert = JsonDocument.create(
          JsonObject.fromJson("{\"largeNumber\": 654654654654654654654654654654654654654654654654654.68798798798654654654654654654654645}"));

    // Printing out correctly "654654654654654654654654654654654654654654654654654.68798798798654654654654654654654645"
    JsonDocument jsonDocument = bucket.get("KEY1");

    // Printing out correctly [{"tests":{"largeNumber":654654654654654654654654654654654654654654654654654.68798798798654654654654654654654645}}]
    N1qlQueryResult result = bucket.query(N1qlQuery.simple("select * from tests"));

    // Truncated number is printed [{"largeNumber":654654654654654700000000000000000000000000000000000}]
    result = bucket.query(N1qlQuery.simple("select largeNumber from tests"));

Is there a way how to get not truncated results when using a query?
Any kind of advice is appreciated.


N1QL uses float64 as numeric data type. big numbers will loose precision when assigned to float64


Thanks for clarification. Is there any roadmap to support a numeric data type suitable for monetary calculations? Something like the decimal128 - IEEE 754 decimal128 decimal-based floating-point numbering format?