我知道柜台家庭可能有任何类型的钥匙。复合键是否不受支持?
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
答案 0 :(得分:1)
由于this answer,我自己解决了这个问题。 您不能插入计数器而不仅仅是设置。 您必须始终使用set counter = counter + n语法:
cqlsh:goh_master> update balance set amount=amount+12 where kind='c' and corporation_id = 103;
像魅力一样工作