#Query graphql based on relationship record title

1 messages · Page 1 of 1 (latest)

restive plaza
#

Hi I am trying to filter the records with title of relationship data as:

query {
COLLECTION_NAME_HERE(limit: 100, where: { categories: { in: [CATEGORY_ID_HERE] } }) {
totalDocs
.
.
.

it works perfectly when I try to filter by category id.
but I want it to be filtered based on category title.

is there any way to do so?

mystic gyroBOT
charred tendon
#

where:{'categories.title':{in:[title]}}

This should do

sharp raptor
charred tendon
#

Yes in 2.0 you cannot but 3.0 you have that fixed

glass arch
#

hello, is there any documentation on how to upgrade from 2.0 to 3.0?

glass arch
#

I think I have same problem as this question author. Documentation conflicts...

At the right is how I have products, categories is a relationship in those products.
At the left I am trying to filter only products that have checkbox showInShop as true (which works) and want to filter by category (which don't). At the top is documentation, it says that it should work with dot.

Maybe some advice? I'm using 2.0, I would upgrade if there is possibility and instructions, but I think 3.0 is in beta, so I think that wouldn't be possible at current time.

sharp raptor
#

that documentation is only for the rest / local API, graphql is different

#

it's not possible to do that type of query in graphql. see the pr description above ^^. the only option is to use the category id like this:

        where: {
          categories: {
            in: [1, 2],
          },
        },