Selecting index from Cassandra list collection

2019-08-28 23:03发布

问题:

I was curious if it's possible to SELECT a specific index from a list collection in Cassandra. Say I have:

CREATE TABLE users (
  user_id text PRIMARY KEY,
  order_list list<text>
);

UPDATE users
   SET ordered_list = [ 'thing1', 'thing2', 'thing3' ] WHERE user_id = 'user1';

Is it possible to then get back an index of ordered_list, such as ordered_list[1] from a CQL query instead of the entire list?

回答1:

No, you can't. You can UPDATE and DELETE with subscripts, but not SELECT or INSERT.