I have a field with json
type in MySQL database. The field contains values like
{
"city_eq": "NewYork",
"rent_true": false,
"estate_type_eq": 0
}
What is the proper way to search records by incoming hash? Like this:
Link.where(json_fields: {
"city_eq": "NewYork",
"rent_true": false,
"estate_type_eq": 0
})
Query should return a record only if all values are the same and presented in field. Order of hash keys might differs.