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 around appending a new key-value pair. Could someone suggest an approach (using PostgreSQL 9.5 BTW)...
Here's my existing stored proc:
CREATE OR REPLACE FUNCTION set_user_token(email TEXT, expiration INTERVAL) RETURNS TEXT AS $$