Update column with type map<boolean, int>

18 views
Skip to first unread message

Tom

unread,
Apr 29, 2023, 5:14:29 PM4/29/23
to DataStax Node.js Driver for Apache Cassandra Mailing List
I have the following table:
```
CREATE TABLE my_table ( id int, map_bool_int_col MAP<boolean, int>, PRIMARY KEY (id) );
```
If I update map_bool_int_col column with the following statement:
```
client.execute("UPDATE my_table SET map_bool_int_col = ? WHERE id = ?", [{"false": 1, "true": 2}, 1], {prepare: true});
```
I end up missing "false: 1" part in the column value, it contains only {"true": 2} part.
I guess this is happening because keys in object are strings and any non empty value is converted to true value.
Inserting {"": 1, "true": 2} value solves the problem, but is seems unnatural.
Is there any way to pass actual boolean values as keys instead of strings?

Bret McGuire

unread,
May 5, 2023, 10:45:30 AM5/5/23
to DataStax Node.js Driver for Apache Cassandra Mailing List, Tom
   Thanks for the question, Tom!

   It looks very much like this corresponds to this question posted on StackOverflow.  Just to close the loop here (in case anybody comes across this list but not the SO post) this resulted in the filing of NODEJS-650 which has since been resolved.  You can find a complete writeup of the underlying issue on the JIRA ticket mentioned above.

   Thanks again!

   - Bret -

Reply all
Reply to author
Forward
0 new messages