title: How to convert PostgreSQL query to Sequalize.js query?
body: <p>I have a table called <strong>Test</strong>, which has below data</p>
  <p><strong>Table</strong></p>
  <pre><code>Test
  -----
  id | org_id | metadata (It's a JSONB column)
  ---------------------------------------
  1  | 65t7   | { &quot;term&quot;: &quot;price_12&quot;, &quot;status&quot;: &quot;Declined&quot;, &quot;switch&quot;: &quot;Cisco&quot;, &quot;capacity&quot;: 109951162777600 }
  2  | 65t7   | { &quot;term&quot;: &quot;price_13&quot;, &quot;status&quot;: &quot;Declined&quot;, &quot;switch&quot;: &quot;Cisco&quot;, &quot;capacity&quot;: 988951162656789 }
  3  | 45t4   | { &quot;term&quot;: &quot;amice_12&quot;, &quot;status&quot;: &quot;Declined&quot;, &quot;switch&quot;: &quot;Cisco&quot;, &quot;capacity&quot;: 109951162777600 }
  4  | 65t7   | { &quot;term&quot;: &quot;werwe_12&quot;, &quot;status&quot;: &quot;Declined&quot;, &quot;switch&quot;: &quot;Cisco&quot;, &quot;capacity&quot;: 174637726481230 }
  </code></pre>
  <p>I am running below query and getting the output</p>
  <pre><code>SELECT * FROM public.Test 
  where org_id = '65t7' 
  and metadata-&gt;&gt; 'term' iLike '%ice_12%' 
  and (metadata-&gt;&gt; 'capacity')::bigint = 109951162777600;
  </code></pre>
  <p><strong>Output</strong></p>
  <pre><code>id | org_id | metadata
  ---------------------------------------
  1  | 65t7   | { &quot;term&quot;: &quot;price_12&quot;, &quot;status&quot;: &quot;Declined&quot;, &quot;switch&quot;: &quot;Cisco&quot;, &quot;capacity&quot;: 109951162777600 }
  </code></pre>
  <p>I am trying to convert it to Sequalize format query</p>
  <p><strong>Code</strong></p>
  <pre><code>let final = {
      where: {
          org_id : '65t7',
          [Op.and]: [
              { 'metadata.term':  { [Op.iLike]: '%ice_12%' }},
              { 'metadata.capacity':  { [Op.is]: 109951162777600 }}
          ]
      }
      limit: 500,
      offset: 0
  };
  
  const res = Test.findAndCountAll(final);
  </code></pre>
  <p><strong>Error:</strong></p>
  <pre><code>at Query.run (C:\Project\test\FilterTest\node_modules\sequelize\dist\lib\dialects\postgres\query.js:50:25)
      at C:\Project\test\FilterTest\node_modules\sequelize\dist\lib\sequelize.js:300:28
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at async PostgresQueryInterface.rawSelect (C:\Project\test\FilterTest\node_modules\sequelize\dist\lib\dialects\abstract\query-interface.js:415:18)
      at async Function.aggregate (C:\Project\test\FilterTest\node_modules\sequelize\dist\lib\model.js:1229:19)
      at async Function.count (C:\Project\test\FilterTest\node_modules\sequelize\dist\lib\model.js:1252:20)
      at async Promise.all (index 0)
      at async Function.findAndCountAll (C:\Project\test\FilterTest\node_modules\sequelize\dist\lib\model.js:1268:27) {
    name: 'SequelizeDatabaseError',
    parent: error: column test.metadata.term does not exist
        at Parser.parseErrorMessage (C:\Project\test\FilterTest\node_modules\pg-protocol\dist\parser.js:287:98)
        at Parser.handlePacket (C:\Project\test\FilterTest\node_modules\pg-protocol\dist\parser.js:126:29)
        at Parser.parse (C:\Project\test\FilterTest\node_modules\pg-protocol\dist\parser.js:39:38)
        at Socket.&lt;anonymous&gt; (C:\Project\test\FilterTest\node_modules\pg-protocol\dist\index.js:11:42)
        at Socket.emit (events.js:400:28)
        at addChunk (internal/streams/readable.js:293:12)
        at readableAddChunk (internal/streams/readable.js:267:9)
        at Socket.Readable.push (internal/streams/readable.js:206:10)
        at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
  </code></pre>