I am using Postgres' JSON data type to store some information.
For example I have model User with a field locations that holds a json document(array of objects containing pairs of keys and values) in the following format:
[{"name": "Location 1", kind: "house"},
{"name": "Location 2", kind: "house"},
{"name": "Location 3", kind: "office"},
...
{"name": "Location X", kind: "house"}
]
I want to query with .where on the JSON data type.
I want to query for users that have at least one location with kind = office.
Thanks!