显示缓冲区types数据的string的cassandra timeuuid列

我正在使用NodeJS Cassandra驱动程序从Cassandra timeuuid列中检索数据。 现在,数据被检索为缓冲区types而不是stringtypes。 我需要数据作为stringtypes

虽然仍然很难理解您期望看到的内容,但这会以更易读的格式返回您的“ PostedDatedate”:

 SELECT DateOf(PostedDate) FROM facehq.timeline; 

另外,随着数据量的增长,未绑定的查询将变得有问题且缓慢。 因此,请尽可能使用WHERE子句来限定这样的查询。

我需要像“posteddate”的结果:“f6ca25d0-ffa4-11e4-830a-b395dbb548cd”。

这听起来像你的问题是在你的node.js代码。 你如何执行你的查询? GitHub项目页面上的Node.js驱动文档有一个例子可以帮助:

 client.stream('SELECT time, val FROM temperature WHERE station_id=', ['abc']) .on('readable', function () { //readable is emitted as soon a row is received and parsed var row; while (row = this.read()) { console.log('time %s and value %s', row.time, row.val); } }) .on('end', function () { //stream ended, there aren't any more rows }) .on('error', function (err) { //Something went wrong: err is a response error from Cassandra }); 

DataStax文档还有一个使用timeUUID的特定示例:

 client.execute('SELECT id, timeid FROM sensor', function (err, result) { assert.ifError(err); console.log(result.rows[0].timeid instanceof TimeUuid); // true console.log(result.rows[0].timeid instanceof Uuid); // true, it inherits from Uuid console.log(result.rows[0].timeid.toString()); // <- xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx console.log(result.rows[0].timeid.getDate()); // <- Date stored in the identifier });