Details
-
Bug
-
Resolution: Unresolved
-
Major
-
4.5.1
-
None
-
Untriaged
-
Unknown
Description
Steps To Reproducing
- Execute the following Java Code using version 2.3.1 of the SDK, it will create two documents, one via N1QL, the other via counter()
import com.couchbase.client.java.*;
import com.couchbase.client.java.document.*;
import com.couchbase.client.java.document.json.*;
import com.couchbase.client.java.query.*;
import com.couchbase.client.java.query.N1qlQuery.*;
import java.lang.Thread;
public class Example {
public static void main(String... args) throws Exception {
Cluster cluster = CouchbaseCluster.create("10.112.151.102");
Bucket bucket = cluster.openBucket("default");
System.out.println(bucket.counter("Java:Counter", 1, 1073741824));
N1qlQueryResult result = bucket.query(
N1qlQuery.simple("UPSERT INTO default (KEY, VALUE) VALUES (\"N1QL:Counter\", 1073741824) RETURNING *")
);
for (N1qlQueryRow row : result) {
System.out.println(row);
}
}
}
- Create the following View:
function (doc, meta) {
emit(meta, doc);
}
- Execute the view:
http://10.112.151.102:8092/default/_design/dev_test/_view/test?connection_timeout=60000&full_set=true&inclusive_end=true&limit=6&skip=0&stale=false
- The result of the view:
{"total_rows":2,"rows":[
{"id":"Java:Counter","key":{"id":"Java:Counter","rev":"1-14a2af68992800000000000000000000","seq":"1","vb":"874","expiration":0,"flags":0,"type":"json"},"value":1073741824},
{"id":"N1QL:Counter","key":{"id":"N1QL:Counter","rev":"1-14a2af689ea900000000000000000000","seq":"1","vb":"749","expiration":0,"flags":0,"type":"json"},"value":1073741824}
]
}
Problem
The document created via the N1QL query, is a string in science notation and not a integer, this can be seen from the raw dump of the couchstore files:
[root@node2-cb451-centos7 default]# /opt/couchbase/bin/couch_dbdump 749.couch.1
|
Dumping "749.couch.1":
|
Doc seq: 1
|
id: N1QL:Counter
|
rev: 1
|
content_meta: 128
|
size (on disk): 25
|
cas: 1486943690859020288, expiry: 0, flags: 0, datatype: 1, conflict_resolution_mode: 0
|
size: 15
|
data: (snappy) 1.073741824e+09
|
|
Total docs: 1
|
[root@node2-cb451-centos7 default]# /opt/couchbase/bin/couch_dbdump 874.couch.1
|
Dumping "874.couch.1":
|
Doc seq: 1
|
id: Java:Counter
|
rev: 1
|
content_meta: 128
|
size (on disk): 20
|
cas: 1486943690766680064, expiry: 0, flags: 0, datatype: 1, conflict_resolution_mode: 0
|
size: 10
|
data: (snappy) 1073741824
|
|
Total docs: 1
|
Unfortunately as shown above the view engine results have expands the science notation:
{"total_rows":2,"rows":[ |
{"id":"Java:Counter","key":{"id":"Java:Counter","rev":"1-14a2af68992800000000000000000000","seq":"1","vb":"874","expiration":0,"flags":0,"type":"json"},"value":1073741824}, |
{"id":"N1QL:Counter","key":{"id":"N1QL:Counter","rev":"1-14a2af689ea900000000000000000000","seq":"1","vb":"749","expiration":0,"flags":0,"type":"json"},"value":1073741824} |
]
|
}
|
Expectation
For the view engine to show the real value i.e the science notation:
{"total_rows":2,"rows":[ |
{"id":"Java:Counter","key":{"id":"Java:Counter","rev":"1-14a2af68992800000000000000000000","seq":"1","vb":"874","expiration":0,"flags":0,"type":"json"},"value":1073741824}, |
{"id":"N1QL:Counter","key":{"id":"N1QL:Counter","rev":"1-14a2af689ea900000000000000000000","seq":"1","vb":"749","expiration":0,"flags":0,"type":"json"},"value":1.073741824e+09} |
]
|
}
|
Attachments
Issue Links
- relates to
-
MB-22761 UI Incorrectly expands science notation
- Closed