# GraphQL query variables not working

**URL:** <https://discourse.getcockpit.com/t/graphql-query-variables-not-working/2813>\
**Category:** Support\
**Created:** [June 20, 2023, 5:50pm UTC](https://discourse.getcockpit.com/t/graphql-query-variables-not-working/2813 "2023-06-20T17:50:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alberto2000](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/alberto2000/32/1362_2.png) [@alberto2000](https://discourse.getcockpit.com/u/alberto2000)\
**Post date:** [June 20, 2023, 5:50pm UTC](https://discourse.getcockpit.com/t/graphql-query-variables-not-working/2813/1 "2023-06-20T17:50:48Z")

</div>

I’m using the slug solution from here: [[cp 2] generate slug when saving collection](https://discourse.getcockpit.com/t/cp-2-generate-slug-when-saving-collection/2432)

My (contrived) query:

```auto
query projectQuery($slug: String) {
  project: projectsModel(filter: {slug: $slug}) {
    _id
    slug
    title
  }
}

```

Query variables:

```auto
{
  "slug": "my-test-slug"
}

```

The result is always an empty projectModel. If I manually enter the slug into the query (instead of `$slug`) the query returns the correct result.

Why isn’t this working? Is it related to the slug solution used?

---

<div class="post-metadata">

**Author:** ![artur](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/artur/32/4_2.png) [@artur](https://discourse.getcockpit.com/u/artur)\
**Post date:** [June 21, 2023, 7:05pm UTC](https://discourse.getcockpit.com/t/graphql-query-variables-not-working/2813/2 "2023-06-21T19:05:40Z")

</div>

> [@alberto2000](#):
>
> ```auto
> query projectQuery($slug: String) {
> project: projectsModel(filter: {slug: $slug}) {
> _id
> slug
> title
> }
> }
> 
> ```

try:

```auto
query projectQuery($filter: JsonType) {
  project: projectsModel(filter: $filter) {
    _id
    slug
    title
  }
}

```

Query variables:

```auto
{"filter": {"slug": "my-test-slug"}}

```
