collections - map update in cassandra with cql3 -


i have cf in cassandra have coulmn type map

this cf below:

create table word_cat (     word text,     doc_occurrence map <text, int >,    total_occurrence map <text, int >,       primary key (word) ); 

i want update doc_occurrence value of key pluse new number.i want in 1 query.

i think in can done in query this:

update word_cat set doc_occurrence ['key']=doc_occurrence ['key']+5 word='name'; 

but not work, can body help?

better explain example, considering schema.

now here inserting data, followed output

cqlsh:ks1> update word_cat set            ...  doc_occurrence=            ...  {'cassandra' : 1}            ...  word ='name'; cqlsh:ks1> select * word_cat ;   word | doc_occurrence | total_occurrence ------+----------------+------------------  name | {cassandra: 1} |             null 

now if want overwrite existing key (cassandra value 5) in map, here go

cqlsh:ks1> update word_cat set            ...  doc_occurrence=            ...  {'cassandra' : 5}            ...  word ='name';  cqlsh:ks1> select * word_cat ;   word | doc_occurrence | total_occurrence ------+----------------+------------------  name | {cassandra: 5} |             null 

update:

the functionality referring in comment including counter value in map. unfortunately counters not allowed inside collection, rather not supported yet. may can have separate counter column family handle things.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -