i'm using node-cassandra-cql driver ( https://github.com/jorgebay/node-cassandra-cql ) to do sample select into a cassandra column family.
My cf has three column with that datatypes:
1 - value -> text
2 - date -> timestamp
3 - hits -> counter
Using nodeJS to fetch rows i do:
client.execute('SELECT date,value,hits FROM cf LIMIT 100', [],
function(err, result) {
if(err){
var error = {error:true,message:err};
res.send(error);
}
else{
var trends = {};
for(var i=0;i<result.rows.length;i++){
var row = result.rows[i];
console.log(row.date);
console.log(row.hits);
}
}
}
);
The console log gives me:
{
"low": 1342763392,
"high": 323,
"unsigned": false
}
{
"low": 1,
"high": 0,
"unsigned": false
}
What i need to do to get correct value?
Thanks!
Cassandra counter column value are a 64-bit signed integer (bigints), in the Node.js driver are represented as Google Closure's Long.
To get the string representation of the decimal value of the bigint, you can use #toString() method.
//"1", "2", ...
row.hits.toString();