I have a jsonb column where I am storing some filtering data. The structure I am storing the data in the column is like the below,
[
{
"filter":[
{
"key":"first_name",
"condition":"has_any_value"
},
{
"key":"count_of",
"value":"1",
"event_id":"130",
}
]
},
{
"filter":[
{
"key":"count_of",
"value":"1",
"event_id":"130"
}
],
"filter_operator":"AND"
},
{
"filter":[
{
"key":"user_id",
"value":"12",
"condition":"equals"
},
{
"key":"count_of",
"value":"112",
"event_id":"130"
],
"filter_operator":"OR"
}
]
I need to query if the filter JSON contains specific event id(Which may exists in any of the "filter
" data), But I can't find a way to query if the specific event Id exists in the structure I have(Array -> each filter
data -> Any of hash may contain the event Id). I am using postgres 10.1. Can anyone help to get this?