0

I am trying to do an insert/increment in cassandra database through node.js...

Suppose I have this table:

CREATE COLUMN FAMILY MsCounter
WITH comparator = UTF8Type
AND key_validation_class=UTF8Type
AND default_validation_class = CounterColumnType;

then let's say i want to insert/increment a row key and a value on MsCounter:

rowKey: 'Tim', columnName1: columnName1 + 1

Is there any way to do this programatically in Node Js using cassandra-client ?

I am aware they show an example of inserting and updating a regular column family, but does the same applied for counter column family ?

4

1 回答 1

3

阅读此示例后,我意识到可以在不使用可选参数的情况下执行 CQL。以下是我的做法:

con.execute('UPDATE MsCounter SET columnName = columnName + 1 WHERE key=?', ['Tim'], function(err) {});
于 2013-06-13T09:34:07.880 回答