How do I filter my client queries by boolean?

Question / Issue

I am trying to filter my project so that I only get the ones where the boolean value, "isHome" is true.
I know about the client's getAllByType("{customtype}"), but I don't fully understand how to use the filter function.

Hi @quentingibson94,

I'll be happy to help you out with this. Can you elaborate a little on what you're trying to do, i. e. where is the filter, what is it filtering, what are you trying to display and where, etc. Any detail helps giving you an answer that'll fit what you need :slight_smile:


Here is my testimony object. I want some to show on my homepage and other to not. I made a field called isHome. How can i use typescript to filter the false isHome fields.


This from my page template looks pretty close to what I need.

Hi @quentingibson94,

Could you try with this, and let me know if it works?

const pages = await client.getAllByType("page", {
  predicates: [
    prismic.filter.at("my.page.isHome", true)
  ],
});