I have a JSON field in Postgres Table (Column name : UserDetails)
[{"name":"UserName","status":"UserStatus","type":"UserType","number":"UserNumber"},{"name":"UserName1","status":"UserStatus1","type":"UserType1","number":"UserNumber1"}]
Basically, an array of objects.
I want to query the column 'UserDetails' to fetch all users whose name contains 'UserName' in typeorm
So far I've achieved to query the exact match against the name field of the JSON column
providedUserName='UserName1'
query.andWhere(`user.userdetails ::jsonb @> '[{"name":"${providedUserName}"}]'`)
How can I query such that I add in a LIKE constraint to the name attribute from the JSON column?
By providing 'UserName' I would like to get list of all users whose name contains 'UserName', in this case it shall return both the values
Thank you