How can I search strings for certain values?


Or how do I create custom queries in general?

I read this stackoverflow-question but have no idea how to implement it in graphcool …


Query on substrings

You can use the built-in filter options for String fields. Let’s say this is your schema:

type Post {
  id: ID!
  text: String!
  title: String!

Then you use this query to get all posts that contain GraphQL in their title:

query {
  allPosts(filter: {
    title_contains: "GraphQL"
  }) {

Some other possible filters include:

  • title_starts_with
  • title_ends_with


That’s nice (and easy)!
Are there options for writing custom code though?


You can hook into the request pipeline of mutations using functions. A similar feature for fully custom queries and mutations is planned as well. :slight_smile:


This wont work if you want to search with string with small case or upper case