You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a more complex query which currently is like this:
.grab$({
...// the other fields
count: [`count(*[_type== "article" && references(^._id) && coalesce(language, 'en') == 'en'])`,
q.number()
]
})
Is there any built in way, or suggestions on how I can optimize the query so I'm not writing long strings of filters (i.e. the old way).
I'm looking for something like:
q.count(q.("*").filterByType("article").filter(q.coalesce("language", 'en')))
// or
q.("*").filterByType("article").count()
I guess I could use select to replace the coalesce, but a built in function would be nice to have where possible:
select(
language => language,
"en"
)
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Code of Conduct
Question
Is there any built in way, or suggestions on how I can optimize the query so I'm not writing long strings of filters (i.e. the old way).
I'm looking for something like:
I guess I could use
select
to replace the coalesce, but a built in function would be nice to have where possible:The text was updated successfully, but these errors were encountered: