2 ms·
PG JSON implementation is solid and supports nearly everything you want from a document database, with the added bonus of joins, queries, ACID, and tooling. How
by e1g 9y ago
PG JSON implementation is solid and supports nearly everything you want from a document database, with the added bonus of joins, queries, ACID, and tooling. However, syntax can be awkward at times -
# Find a row by JSON property value
select * from person where details->>'name' ilike '%james%'
# check for property existence
select * from person where details ? 'is_hidden'
# Override a single property in a JSON field -
update person set details = details || '{"phone":"911"}'
# Alt increment existing value
update person set details = jsonb_set(details, '{views}', (details->'views')+1)
More examples at https://www.postgresql.org/docs/current/static/functions-json.html https://www.postgresql.org/docs/current/static/functions-jso...