I’m using mysql 5.7 and I have a collumn (cars
) whose value looks like:
[
{
"id": 1,
"model": "bar"
},
{
"id": 2,
"model": "foo"
}
]
I need the id (or the all object) where model = 'foo'
, expected: 2
.
I already tried this:
query: select JSON_SEARCH(cars, "one", 'foo', NULL, '$[*].model') from orders;
output: $[1].model
But no luck.