title: Find position of object in postgres jsonb array
body: <p>I have an array of objects that looks like this within the jsonb <code>value</code> column of a table:</p>
  
  <pre><code>"west": [
    {"id": "aa92f346-7a93-4443-949b-4eab0badd983", "version": 1},
    {"id": "cd92e346-6b04-3456-050a-5eeb0bddd027", "version": 3}
  ]
  </code></pre>
  
  <p>I'm aiming to remove certain objects from this array based on their id and version like so:</p>
  
  <pre><code>SELECT value::jsonb #- '{west, 1}' FROM game.settings;
  </code></pre>
  
  <p>However, the <code>1</code> 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 <code>"id": "cd92e346-6b04-3456-050a-5eeb0bddd027", "version": 3</code>).</p>
  
  <p>How would I go about determining this array position and passing it into the spot my hard-coded <code>1</code> currently holds?</p>