We've made filtering way easier

Mark Catalano

Co-Founder, TakeShape

The new "where" filter for GraphQL queries is a powerful way to filter content

The “where” parameter for GraphQL queries opens up a whole new word of possibilities for filtering. This is a huge improvement to how filtering works in TakeShape. 

Code completion of properties and operators in the API Explorer makes it easy to write and test filters.

Filters

Logic Operators

# AND, OR, NOT

{
  "where": {
    "OR": [
      {
        "title": {
          "match": "engineer"
        }
      },
      {
        "NOT": {
          "hotJob": {
            "eq": true
          }
        }
      }
    ]
  }
}

Comparison Operators

# eq, in, gt, gte, lt, lte, match, regexp

{
  "where": {
    "book_image": {
      "filename": {
        "match": "my-file"
      }
    },
    "post_image": {
      "regexp": ".*.png"
    }
  }
}

Dates

# yyyy-mm-dd - ISO 8601

{
  "where": {
    "title": {
      "in": ["Front-End Developer", "Engineering Manager"]
    },
    "_createdAt": {
      "gte": "now-1w"
    }
  }
}

Relationships and Workflows

# Workflow

{
  "where": {
    "_status": {
      "gt": "draft",
      "lt": "published"
    }
  }
}

Check out the full documentation for more information. Log in and try out the new where filtering right in the API explorer