Q: How to update properties value in the array of jsonb field?
Hi All,
I run Postgres13 (PostgreSQL 13.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit)
I have a jsonb field type (fieldname is test), like below JSON array format, how to update is_read properties in extras node to true where the users_pid=1 and is_read = false?
Hi All,
I run Postgres13 (PostgreSQL 13.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit)
I have a jsonb field type (fieldname is test), like below JSON array format, how to update is_read properties in extras node to true where the users_pid=1 and is_read = false?
Code:
[ { "data": { "users_pid": 1, "datetime": "2022-05-01 13:10:58", "extras": { "is_read": false, "read_dt": "" } } }, { "data": { "users_pid": 3, "datetime": "2022-05-23 11:03:22", "extras": { "is_read": false, "read_dt": "" } } }, { "data": { "users_pid": 1, "datetime": "2022-05-13 11:23:22", "extras": { "is_read": false, "read_dt": "" } } } ]
Comment