简体   繁体   English

使用node.js将UUID写为cassandra中的文本

[英]Write UUID as text in cassandra with node.js

I have a column in cassandra table user_id which is type text. 我在cassandra表user_id中有一个列,它是类型文本。 I'm trying to pass generated uuid which is packed as string to be written in the table. 我正在尝试传递生成的uuid,它被打包为要写入表中的字符串。 When I do this I get an error: 当我这样做时,我收到一个错误:

Not a valid text value, expected String obtained uuid

I tried with using hints when I pass parameter: 我在传递参数时尝试使用提示:

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

But I still get an error: 但我仍然得到一个错误:

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

I'm using cassandra version: 2.2.4 我正在使用cassandra版本:2.2.4

Any idea how to solve this problem? 知道如何解决这个问题吗?

I found the problem. 我发现了这个问题。 I was using: 我用的是:

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

When I removed {prepare: true} it started to work ok. 当我删除{prepare:true}时,它开始正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM