Re: [GENERAL] Appending key-value to JSONB tree

2016-02-18 Thread Deven Phillips
Answering my own question here... The gist is that if you need to add a new key-value pair, you use *jsonb_set* on the non-existent key and then provide the value as the final parameter.. The new stored procedure looks like: CREATE OR REPLACE FUNCTION set_user_token(email TEXT, expiration

[GENERAL] Appending key-value to JSONB tree

2016-02-17 Thread Deven Phillips
I have a "user" document with a key "tokens" and I would like to write a stored procedure for adding new token key-value pairs to the "tokens" part of the tree without removing the old values. I have figured out how to replace the existing value in the "tokens", but I cannot seem to wrap my head