'Updating JSON using QueryBuilder
I am creating a project using nestjs and postgress. I want to update a property (owner) in my table orders. So the property is a JSON object which is similar to this
{ name: "John", gender: "M" }
and would like to update it to
{ name: "Jacob", gender: "M" }
My current function is this, but its seems to be not working
return this.createQueryBuilder('orders')
.update()
.set({'owner->>firstName': newFirstName} as any)
.where(`id = :id`, { id: id})
PS: I cannot use jsonb as we are using old version of postgres and typeorm
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
