"Where" condition in predicate.at

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!

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

Thanks a lot! :smiling_face_with_three_hearts:
(I searched "where condition" on the documentation, but i didn't find anything)

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

Yes, it's perfect, it's working fine!

1 Like

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