Is there a JSON
function in mysql that will ignore trying to add the element if it already exists? For example:
update waitinglist SET
new = JSON_ARRAY_APPEND(new, '$', "orange")
where id=2;
update waitinglist SET
new = JSON_ARRAY_APPEND(new, '$', "orange")
where id=2;
Now my array looks like:
["apple", "orange", "orange", "orange", "orange"]
But I want it to work like a set, and just be:
["apple", "orange"]
Is there a way to do this?