title: How do I check if an array column contains a value in Postgres using Objection JS?
body: <p>I tried using an array of integers, then an array of strings. However, I keep  getting the same error:</p>
  <pre><code>ERROR:  operator does not exist: jsonb ?| integer[]
  </code></pre>
  <p>My query looks like this:</p>
  <pre><code>Bet.query()
      .select(
          'id', 
          'status'
      )
      .whereJsonSupersetOf('participants_ids', [userId])
      .range()
      .limit(10)   
      .orderBy('id', 'DESC')
      .throwIfNotFound();
  </code></pre>
  <p>This is how the arrays are stored:</p>
  <p><a href="https://i.stack.imgur.com/NXfB7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NXfB7.png" alt="enter image description here" /></a></p>
  <p>Each user has a screen where they can see their own bets against another users. In order to list bets for a logged in user, I need to check the participants_ids column. This is an array that contains the ids for the 2 users betting against each other.</p>
  <p>The purpose of my query is to return a list of bets where the current user's Id is contained inside each bet's participants_ids array.</p>
  <p>Originally, I tried user <code>.where()</code> and <code>.orWhere()</code> to check if the current user's id was either the bet host's id, or the bet challenger's id. This didn't give me the result I wanted though. So I decided an array column would be much better.</p>
  <p>I can't seem to get this to work though. I've looked at a few posts, but they seem to be arrays of objects rather than arrays of ints or strings. I simply want to check the participants_ids array column contains the userId I am passing into the query.</p>
  <p>I am also using Knex JS.</p>
  <p>Any idea what I could be doing wrong here?</p>
  <p>Thanks in advance.</p>