I have an array of objects that looks like this within the jsonb value column of a table:
"west": [
{"id": "aa92f346-7a93-4443-949b-4eab0badd983", "version": 1},
{"id": "cd92e346-6b04-3456-050a-5eeb0bddd027", "version": 3}
]
I'm aiming to remove certain objects from this array based on their id and version like so:
SELECT value::jsonb #- '{west, 1}' FROM game.settings;
However, the 1 should not be hard-coded, but rather should equal the position of the object within the array which matches the id and version I'm looking for (in this case "id": "cd92e346-6b04-3456-050a-5eeb0bddd027", "version": 3).
How would I go about determining this array position and passing it into the spot my hard-coded 1 currently holds?