April 2017
Beginner to intermediate
360 pages
9h 35m
English
This access pattern is quite familiar, and we can anticipate that it's just as vulnerable to data loss as the serialized approach we explored previously. The beauty of a collection column is that if we want to add a value to the set, we can write a CQL statement to do just that. Let's pick up our scenario with the addition of carol's star to alice's status update:
UPDATE "user_status_updates" SET "starred_by_users" = "starred_by_users" + {'carol'} WHERE "username" = 'alice' AND "id" = 76e7a4d0-e796-11e3-90ce-5f98e903bf02;
Note that in the preceding statement, the previous value of the starred_by_users column does not appear; in fact, during the entire operation, there is no need for us to read data from the row ...
Read now
Unlock full access