如何使用prepare读取结果值

巴韦什

我正在查询将pepare设置为true的cassandra

client.execute(query, [date], { prepare: true })
        .then((result) => {console.log('Row updated on the cluster');
    });

在这里,我得到了带有参数类型的结果,以及从中得到的值如何;

假设我得到这样的东西

{ date: LocalDate: 2018-12-08, calls: Long: 11 }

这种类型作为对象出现,但是我无法将其作为对象读取,也不想使用regex或split()来读取它。有没有办法直接读取它,例如:-11和2018-12-08没有数据类型,我正在为节点js使用cassandra-driver

巴韦什

我得到了答案,这就是它对我有效的方式

client.execute(query, [ date ], { prepare: true })
  .then(result => {
    result.rows.forEach(row => console.log(row["calls"].toString()));
  });

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章