Like what we’re doing? Star us on GitHub!

GraphQL Query $where Clause Example

10 months ago
1 1


I'm trying to query using the $where clause but am receiving a typed error. I'm following the example at but still can't figure out why the type conversion is failing.

Playground Query:

Screen Shot 2022-05-26 at 2 20 13 pm


Screen Shot 2022-05-26 at 2 22 31 pm

Any assistance would be greatly appreciated :-)


  • freakyfriday
    10 months ago

    If anyone is following I figured it out. I had to change the type of $where from JSON to Post_where:

    Screen Shot 2022-05-26 at 2 37 26 pm

    1 reply
  • jmikrut
    Payload Team
    10 months ago

    @freakyfriday — I can do you one better.

    While your syntax DOES work, the better way would be like this:


    No $ needed. Just use the where argument!

Open the post
Continue the discussion in GitHub
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More