简体   繁体   中英

Write UUID as text in cassandra with node.js

I have a column in cassandra table user_id which is type text. I'm trying to pass generated uuid which is packed as string to be written in the table. 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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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