I'm having a hard time querying jsonb data. I'm not used to dealing with jsonb types in postgres . Is it possible to do a WHERE IN on a jsonb field?
I have data like this
id | act | act_id | from_ids | object_ids | post_date
2 post 1 {"2":"1494308197"} {"items":["104564"]} 1494308197
I'm trying to do something like this below to find any ids in the from_ids column where the id is the key.
SELECT an.* FROM activity_network an, jsonb_each(an.from_ids) d WHERE d.key->> in ('2');
But obviously that doesn't work. I tried various forms.
I found a similar question but it doesn't work for what I need as it gets the value and I need to get key using IN.
Not sure how to use these jsonb functions.