1

我知道柜台家庭可以拥有任何类型的钥匙。不支持复合键吗?

 cqlsh:goh_master> create columnfamily balance (kind ascii, corporation_id ascii, amount  counter, primary key ( kind,corporation_id) ) with compact storage;
 cqlsh:goh_master> insert into balance(kind,corporation_id,amount) values ('c',103,123456789);
 Bad Request: invalid operation for commutative columnfamily balance
 cqlsh:goh_master> create columnfamily balance (kind ascii, corporation_id ascii, amount counter, primary key ( kind,corporation_id) ) with compact storage;
 cqlsh:goh_master> insert into balance(kind,corporation_id,amount) values ('c',103,123456789);
 Bad Request: invalid operation for commutative columnfamily balance
4

1 回答 1

1

I solved it by myself thanks to this answer. You cant insert into counters nor just set. You must always use set counter =counter +n syntax:

cqlsh:goh_master> update balance set amount=amount+12 where kind='c' and corporation_id = 103;

worked like a charm

于 2012-06-15T17:21:30.427 回答