View interger overflow


#1

Interger overflow at view building.

My view script:
function (doc, meta) {
if(doc.status == 1 && doc.ftiInternalDataType == “oec_points”){
emit(doc.oec_number, doc.points);
}
}

Rersult :
9276002266500068
oec_points_9276002266500069event53

{
“type”: “event”,
“rid”: “event53”,
“description”: “Roadshow Indischer Ozean”,
“agency_number”: “129798”,
“oec_number”: 9276002266500068,
“points”: 100,
“timestamp_points”: 1503415679,
“status”: 1,
“event”: null,
“subid”: null,
“subtitle”: null,
“startup”: null,
“ftiInternalDataType”: “oec_points”
}

Couch dokument oec_points_9276002266500069event53:
{
“type”: “event”,
“rid”: “event53”,
“description”: “Roadshow Indischer Ozean”,
“agency_number”: “129798”,
“oec_number”: 9276002266500069,
“points”: 100,
“timestamp_points”: 1503415679,
“status”: 1,
“event”: null,
“subid”: null,
“subtitle”: null,
“startup”: null,
“ftiInternalDataType”: “oec_points”
}

**See the diffrent in oec_number!!! **
View value -> 9276002266500068
Dokument value ->9276002266500069

WTF…

Version: Community Edition 6.0.0 build 1693 on docker from image: couchbase:community-6.0.0


#2

Javascript implementations (including V8 as used by the View Engine) typically represent numbers internally as type double. As such, if you are trying to manipulate large integers and do not want rounding to occur you should consider representing them as a string.