Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

958
Views
TypeORM - JSONB where object in array LIKE value

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

SELECT id FROM study, jsonb_array_elements(findings) as elem WHERE elem->>'id'='patientName' AND  elem->>'value' ILIKE '%Dom%';

Here is my TypeORM query:

createQueryBuilder()
      .select(['id'])
      .addSelect('jsonb_array_elements(findings)', 'elem')
      .from(DbStudy, 'study')
      .andWhere(`"elem"->>"id" = 'patientName'`)
      .andWhere(`"elem"->>"value" ILIKE :patientName`, {
        patientName: `%${name}%`,
      });

It ends up generating a query like:

SELECT id, jsonb_array_elements(findings) AS "elem" FROM "study" "study" WHERE "elem"->>"id" = 'patientName' AND "elem"->>"value" ILIKE $1

Which doesn't work column "elem" does not exist.

Any suggestions?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!