#is it possible to Query by slug name?

10 messages · Page 1 of 1 (latest)

tribal mason
#
const Posts: CollectionConfig = {
    slug: 'posts',
    fields: [
       {
            name: 'tags',
            type: 'relationship',
            relationTo: 'tags',
            hasMany: true,
            admin: {
                position: 'sidebar',
            },
        },
    ]

something like this:

const query = {
    tags: {
        equals: 'tech', 
    },
}

it's works when i'm passing mongoDb id instead of text.

hidden ember
#

Is slug the field name in tags?

#

“tags.slug”: { equals: “tech” }

tribal mason
#

const Tags: CollectionConfig = {
  slug: 'tags',
  fields: [
    {
      name: 'name',
      type: 'text',
    },
  ]
}
hidden ember
#

ok so the query would be:

“tags.name”: { equals: “tech” }
tribal mason
#

can i send request with this query directly in graphql?

hidden ember
#

No, not currently

#

but its on the roadmap