I'm working on a real estate application that uses a postgres database. I need to query a json field for a specific condition and I'm not sure how to do that.
The json data is stored in a column called "conditions". For example, a buyer might have the following conditions:
{
"subject to financing": {"date": "2020-05-30", "time": "2100", "done": true},
"inspection": {"date": "2020-05-30", "time": "2100", "done": true},
"be my friend": {"date": "2020-05-30", "time": "2100", "done": true}
}
I want to write query that checks if all conditions are met. In the above case, that means cycling through all conditions and checking that their "done" property is true.
How does one write a query like that with json data? Thanks.