Let's say I have a JSON object with the following structure:
{
"_id":"0000abcdefg",
"type":"PP",
"subscription":{
"subscribers":{
"physicSubscribers":[
{
"civility":"M",
"lastname":"DOE",
"firstname":"John",
"emailAddress":"john-doe@something.com",
},
{
"civility":"M",
"lastname":"smith",
"firstname":"TED",
"emailAddress":"ted-smith@something.com",
}
]
}
}
}
How can I search for the documents by subscription.subscribers.physicSubscribers[*].firsname, but converting the value to lowercase before comparing?
I have tried some solutions this, but it is always returning an empty result:
SELECT doc ->> '$'
FROM customers
WHERE lower(JSON_EXTRACT(doc,'$.subscription.subscribers.physicSubscribers[*].firstname')) = 'john'
Thank you!