使用 node.js 在 cassandra 中将 UUID 写入文本
Write UUID as text in cassandra with node.js
我在 cassandra table user_id 中有一列是文本类型。我正在尝试传递生成的 uuid,它被打包为要写入 table 的字符串。当我这样做时,出现错误:
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
知道如何解决这个问题吗?
我发现了问题。我正在使用:
client.execute(query, parameters, {prepare: true}, function(err, result)
当我删除 {prepare: true} 后它开始正常工作。
我在 cassandra table user_id 中有一列是文本类型。我正在尝试传递生成的 uuid,它被打包为要写入 table 的字符串。当我这样做时,出现错误:
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
知道如何解决这个问题吗?
我发现了问题。我正在使用:
client.execute(query, parameters, {prepare: true}, function(err, result)
当我删除 {prepare: true} 后它开始正常工作。