Discrete list manipulation

Lists, like sets, allow us to discretely add and remove elements without reading the existing contents or overwriting the entire collection. However, since elements in a list have a defined order, we have many more ways to specify what we'd like to add or remove, and where in the list we'd like it to go.

One of the simplest operations we can do is to append an element to the end of a list. This looks just like adding an element to a set, correcting for the different literal syntax:

UPDATE "user_status_updates" SET "shared_by" = "shared_by" + ['carol'] WHERE "username" = 'alice' AND "id" = 76e7a4d0-e796-11e3-90ce-5f98e903bf02; 

This append operation specifically instructs Cassandra to put carol at the end of the ...

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.