top | item 43017194 (no title) javaunsafe2019 | 1 year ago I also don't get it - it's super easy to write queries with it. Please elaborate... discuss order hn newest nonethewiser|1 year ago stuff like thisSELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @> '{"tags": ["qui"]}';orSELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @? '$.tags[*] ? (@ == "qui")';which find documents in which the key "tags" contains array element "qui"https://www.postgresql.org/docs/current/datatype-json.html Tostino|1 year ago I had to ask Claude because I've never worked with Mongo, but apparently the equivalent query for MongoDB is: db.api.find( { "tags": "qui" }, { "guid": 1, "name": 1, "_id": 0 } ) load replies (1)
nonethewiser|1 year ago stuff like thisSELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @> '{"tags": ["qui"]}';orSELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @? '$.tags[*] ? (@ == "qui")';which find documents in which the key "tags" contains array element "qui"https://www.postgresql.org/docs/current/datatype-json.html Tostino|1 year ago I had to ask Claude because I've never worked with Mongo, but apparently the equivalent query for MongoDB is: db.api.find( { "tags": "qui" }, { "guid": 1, "name": 1, "_id": 0 } ) load replies (1)
Tostino|1 year ago I had to ask Claude because I've never worked with Mongo, but apparently the equivalent query for MongoDB is: db.api.find( { "tags": "qui" }, { "guid": 1, "name": 1, "_id": 0 } ) load replies (1)
nonethewiser|1 year ago
SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @> '{"tags": ["qui"]}';
or
SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @? '$.tags[*] ? (@ == "qui")';
which find documents in which the key "tags" contains array element "qui"
https://www.postgresql.org/docs/current/datatype-json.html
Tostino|1 year ago