node.js - Cassandra - NodeJS - 检索 map 类型值时出现问题

标签 node.js cassandra helenus

我在我的 Node-js 项目中使用 helenus 来获取/设置 cassandra 中的值。我的表中有一个 MapType 字段,但是当我从表中检索值时,我得到一个空的键值集。

下面是我的表的架构

CREATE TABLE datapoints (
  id uuid PRIMARY KEY,
  created_at timestamp,
  properties map<text,text>
);

我已使用下面的查询插入了 cql 中的值

INSERT INTO datapoints (id, properties) VALUES (24053e20-63e9-11e3-8d81-0002a5d5c51b, { 'fruit' : 'apple', 'band' : 'Beatles' });

下面是我的nodejs代码:

var helenus = require('/usr/local/lib/node_modules/helenus')
var pool = new helenus.ConnectionPool({
    hosts      : ['localhost:9160'],
    keyspace   : 'mykeyspace',
    timeout    : 3000
  });
pool.connect(function(err, keyspace){
  if(err){
    console.log("connect me error")
    throw(err);
  } else {
    pool.cql("SELECT * FROM datapoints", [], function(err,results){
      console.log("results", results)
      results.forEach(function(row){
        props = row.get('properties').value;
        var id = row.get('id').value;
        console.log("properties", props);
        console.log("id", id);
      });
    })
  }
});

console.log("properties", props); 返回一个函数,当我调用该函数时,我得到一个空的键值集。请帮忙。

最佳答案

集合类型的反序列化似乎存在问题。过去发出的拉取请求破坏了反序列化。我刚刚向版本 0.6.8 推送了一个修复程序,应该可以解决这个问题。

关于node.js - Cassandra - NodeJS - 检索 map 类型值时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20580425/

相关文章:

node.js - 为 React Native 安装 Node.js

Mysql:ER_PARSE_ERROR:从 Node js发送创建过程代码时

mysql - 如何在 Sequelize 关联两个表

javascript - 如何为我的生产环境配置 Redis Store?

java - 为什么我们不在 Spark-Cassandra-Connector 中定义一个 ReaderBuilder 来从 cassandra DB 读取数据

ssl - 无法通过 cqlsh 连接 ssl 节点

cassandra - 使用 Cassandra 和 CQL3,如何在单个请求中插入整个宽行?

node.js - 在 CQL 查询中更改 Helenus 一致性级别