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
@Test
public void testDemoTestCase() {
final JsonDocument docToUpsert = JsonDocument.create(
"KEY1",
JsonObject.fromJson("{\"largeNumber\": 654654654654654654654654654654654654654654654654654.68798798798654654654654654654654645}"));
bucket.upsert(docToUpsert);
// Printing out correctly "654654654654654654654654654654654654654654654654654.68798798798654654654654654654654645"
JsonDocument jsonDocument = bucket.get("KEY1");
System.out.println(jsonDocument.content().getBigDecimal("largeNumber"));
// Printing out correctly [{"tests":{"largeNumber":654654654654654654654654654654654654654654654654654.68798798798654654654654654654654645}}]
N1qlQueryResult result = bucket.query(N1qlQuery.simple("select * from tests"));
System.out.println(result.allRows());
// Truncated number is printed [{"largeNumber":654654654654654700000000000000000000000000000000000}]
result = bucket.query(N1qlQuery.simple("select largeNumber from tests"));
System.out.println(result.allRows());
}
Is there a way how to get not truncated results when using a query?
Any kind of advice is appreciated.
Thanks.