title: TypeORM - JSONB where object in array LIKE value
body: <p>I'm trying to port this query to TypeORM, and I cannot figure it out. Does anyone have any suggestions? I keep receiving column not found errors</p>
  <pre><code>SELECT id FROM study, jsonb_array_elements(findings) as elem WHERE elem-&gt;&gt;'id'='patientName' AND  elem-&gt;&gt;'value' ILIKE '%Dom%';
  </code></pre>
  <p>Here is my TypeORM query:</p>
  <pre><code>createQueryBuilder()
        .select(['id'])
        .addSelect('jsonb_array_elements(findings)', 'elem')
        .from(DbStudy, 'study')
        .andWhere(`&quot;elem&quot;-&gt;&gt;&quot;id&quot; = 'patientName'`)
        .andWhere(`&quot;elem&quot;-&gt;&gt;&quot;value&quot; ILIKE :patientName`, {
          patientName: `%${name}%`,
        });
  </code></pre>
  <p>It ends up generating a query like:</p>
  <pre><code>SELECT id, jsonb_array_elements(findings) AS &quot;elem&quot; FROM &quot;study&quot; &quot;study&quot; WHERE &quot;elem&quot;-&gt;&gt;&quot;id&quot; = 'patientName' AND &quot;elem&quot;-&gt;&gt;&quot;value&quot; ILIKE $1
  </code></pre>
  <p>Which doesn't work column &quot;elem&quot; does not exist.</p>
  <p>Any suggestions?</p>