【问题标题】:Write UUID as text in cassandra with node.js使用 node.js 在 cassandra 中将 UUID 写为文本
【发布时间】:2016-04-16 19:39:48
【问题描述】:

我在 cassandra 表 user_id 中有一个类型为文本的列。我正在尝试传递生成的 uuid,它被打包为要写入表中的字符串。当我这样做时,我得到一个错误:

Not a valid text value, expected String obtained uuid

我在传递参数时尝试使用提示:

{hint: 'String', value: data['userId']}

但我仍然收到错误:

[TypeError: Not a valid text value, expected String obtained { hint: 'String',
  value: 'e738922c-2277-45fd-aa94-7f5e7a189084' }]

我使用的是 cassandra 版本:2.2.4

知道如何解决这个问题吗?

【问题讨论】:

  • 如何生成uuid?你确定它实际上是一个字符串? typeof(uuid) 返回什么?

标签: node.js cassandra uuid


【解决方案1】:

我发现了问题。我正在使用:

client.execute(query, parameters, {prepare: true}, function(err, result)

当我删除 {prepare: true} 时,它开始正常工作。

【讨论】:

    猜你喜欢
    • 2015-11-28
    • 2011-03-15
    • 2018-11-12
    • 2019-08-25
    • 1970-01-01
    • 2014-02-27
    • 1970-01-01
    • 2017-08-11
    • 1970-01-01
    相关资源
    最近更新 更多