{"action":"opened","issue":{"url":"https://api.github.com/repos/thomas4019/mongo-query-to-postgres-jsonb/issues/1","repository_url":"https://api.github.com/repos/thomas4019/mongo-query-to-postgres-jsonb","labels_url":"https://api.github.com/repos/thomas4019/mongo-query-to-postgres-jsonb/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/thomas4019/mongo-query-to-postgres-jsonb/issues/1/comments","events_url":"https://api.github.com/repos/thomas4019/mongo-query-to-postgres-jsonb/issues/1/events","html_url":"https://github.com/thomas4019/mongo-query-to-postgres-jsonb/issues/1","id":153451912,"number":1,"title":"Match a Field Without Specifying Array Index","user":{"login":"ziege","id":1983424,"avatar_url":"https://avatars.githubusercontent.com/u/1983424?v=3","gravatar_id":"","url":"https://api.github.com/users/ziege","html_url":"https://github.com/ziege","followers_url":"https://api.github.com/users/ziege/followers","following_url":"https://api.github.com/users/ziege/following{/other_user}","gists_url":"https://api.github.com/users/ziege/gists{/gist_id}","starred_url":"https://api.github.com/users/ziege/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ziege/subscriptions","organizations_url":"https://api.github.com/users/ziege/orgs","repos_url":"https://api.github.com/users/ziege/repos","events_url":"https://api.github.com/users/ziege/events{/privacy}","received_events_url":"https://api.github.com/users/ziege/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-06T13:32:50Z","updated_at":"2016-05-06T13:32:50Z","closed_at":null,"body":"I think this is what you're looking for:\r\nSELECT * FROM (SELECT e.value FROM test t, jsonb_array_elements(t.test#>'{memos}') e) v WHERE v.value->>'by' = 'shipping'\r\n\r\n(Tested with the MongoDB exmaple: https://docs.mongodb.com/manual/tutorial/query-documents/#match-a-field-without-specifying-array-index)"}}