Vincent07
(Vincent Blondaux)
1
Hi!
I have a customtype with a field BOOLEAN "old".
Is it possible to get all theses items?
Something like this:
async asyncData({ $prismic, params, error }) {
const { results: clients } = await $prismic.api.query(
$prismic.predicate.at('document.type', 'client', { old: 'false' })
)
return {
clients
}
}
Thanks a lot!
Pau
3
Hey there @Vincent07, you can use my.custom-type.field
for Boolean fields,
[at(my.client.old, false)]
Check out the REST API reference to learn more about predicates
1 Like
Vincent07
(Vincent Blondaux)
4
Thanks a lot!
(I searched "where condition" on the documentation, but i didn't find anything)
Pau
5
The at filter works similarly as the where the condition does. It is used to extract only those results that fulfill a specified condition.
1 Like
Vincent07
(Vincent Blondaux)
6
Yes, it's perfect, it's working fine!
1 Like
Vincent07
(Vincent Blondaux)
8
Edit : everything is ok.
My final code:
const { results: articles } = await $prismic.api.query(
$prismic.predicate.at('document.type', 'article'),
{
orderings: '[document.first_publication_date desc]',
//orderings=[document.first_publication_date]
}
)
2 Likes