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

183
Views
TypeORM - appending new items to array-type column (Postgres)

Postgres supports array type columns, and exposes methods for working with those arrays (like array_append). I'm wondering if TypeORM allows using those methods somehow.

In case it's not supported, what do you think the best way to append items to PG array? Doing something like get-and-set? (a transaction of getting the value, creating the new new array with js, and updating the value in the DB)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use native Postgres methods like array_append if you use the TypeORM Query Builder.

Example below:

await dataSource.createQueryBuilder()
  .update(User)
  .set({
    yourArrayColumn: () => `array_append("yourArrayColumn", 1)`
  })
  .where("id = :id", { id: 1 })
  .execute();

More about using TypeORM Query Builder for updates: https://typeorm.io/update-query-builder

about 4 years ago · Juan Pablo Isaza Report
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!