3 ms·
Postgres's jsonb format is definitely not "essentially" a string. You can get native indexes on json fields in Postgres, and you can query fields however you li
by indigo945 6y ago
Postgres's jsonb format is definitely not "essentially" a string. You can get native indexes on json fields in Postgres, and you can query fields however you like.
- Beefin 6y agohttps://www.postgresql.org/docs/9.5/functions-json.html https://www.postgresql.org/docs/9.5/functions-json.html they are surrounded by quotes, is that not a string ?
- indigo945 6y agoIf a man is surrounded by trees, does he become a grove?
- fabian2k 6y agoThose are json literals in the SQL query. That has nothing at all to do with how json is stored in jsonb columns in the database itself.
- gnulinux 6y agoThis is among the most shallow comment I ever saw on HN. Just because `TreeSet a = [1,2,3]` is surrounded by [ and ] does that mean `a` is a list? When you do `jsonb j = '{"a":"c"}` postgres builds a separate data structure for you from that json, which allows you to use a btree index.
- Beefin 6y agoSELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @> '{"tags": ["qui"]}'; vs db.api.find({tags:"qui"}, {guid:1, name:1})
- takeda 6y agoNot sure what you are trying to show here, but only SQL statement helped me to understand that {guid: 1, name: 1} is to show these fields.