Re: Doing an upsert into a collection?

2016-10-25 Thread Michael Mior
You could do this with a map instead of a list. *CREATE TABLE movie (* * id text,* * name text,* * ratings map,* * PRIMARY KEY ( id )* *);* *UPDATE movie SET ratings['bob'] = 5 WHERE id = 'terminator 3';* -- Michael Mior michael.m...@gmail.com 2016-10-24 18:16 GMT-04:00 Ali Akhtar

Re: Doing an upsert into a collection?

2016-10-24 Thread kurt Greaves
On 24 October 2016 at 22:16, Ali Akhtar wrote: > *UPDATE movie set ratings.rating = 5 WHERE ratings.user = 'bob'* You won't be able to do this because you're trying to update a row without specifying the primary key. Also, even if you did add the PK to the where, you've

Doing an upsert into a collection?

2016-10-24 Thread Ali Akhtar
Say I have this UDT: *CREATE TYPE rating (* * user text,* * rating int* *);* And, I have this table: *CREATE TABLE movie (* * id text,* * name text,* * ratings list,* * PRIMARY KEY ( id )* *);* Say a user 'bob' rated a movie as a 5. Is it possible to do something like this: *UPDATE