'Check in groq query if array of objects contains a case insensitive string
I have an object that has an array called tags. It is array of objects.
I need to query those objects that its tags contains a case insensitive string.
[
{
"_createdAt": "2022-02-18T09:16:27Z",
"_id": "article-13000018493",
"_rev": "LRHtyYM9ePAzIgMqDbhEWY",
"_type": "article",
"_updatedAt": "2022-02-23T14:29:00Z",
"slug": {
"current": "learn-to-kode"
},
"tags": [
{
"value": "Java"
},
{
"value": "Python"
},
{
"value": "JS and ts"
},
{
"value": "React"
}
],
"tittel": "Learn to code"
},
{
"_createdAt": "2022-02-18T09:16:27Z",
"_id": "article-352398563",
"_rev": "LRHtyYM9ePAzIgMqDbhEWY",
"_type": "article",
"_updatedAt": "2022-02-23T14:29:00Z",
"slug": {
"current": "learn-to-kode-js"
},
"tags": [
{
"value": "React"
},
{
"value": "Next.js"
},
{
"value": "js and TS"
},
{
"value": "Vue"
}
],
"tittel": "Learn to code JS"
}
]
I have used this query
*[_type == 'articles' && 'js and TS' in tags[].value] {
...,
tags[] { value }
}
It returns only the last object because the first object's tags contains JS and ts, not js and TS.
How to fetch both of the objects if the tags contains a case insensitive parameter?
This is link of my query on groq.dev.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
