I'd like to append a value to an array in a record that looks similar to the following:
{
_id: 'foo',
cols: [
'abc123',
'123abc'
]
}
It's possible that this field doesn't exist and will need to be created prior to appending. I also don't want to append to the array if the value already exists in the array. So far I have the following which satisfies all but the last requirement of not adding duplicate entries.
r.table('users')
.get(userId)
.update({
cols: r.row('cols').default([]).append(uuid)
})
Any help appreciated, thanks!