From 2f1b4879b8676e5c4a0d9df791db31bf8a7cb85d Mon Sep 17 00:00:00 2001 From: Jakub Holy Date: Thu, 6 Dec 2018 17:23:04 +0100 Subject: [PATCH] docs(graphql-reference): clarify filtering using comma/and operator (#10321) --- docs/docs/graphql-reference.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/docs/graphql-reference.md b/docs/docs/graphql-reference.md index abbdcaab9391d..f2ed5a6acb11e 100644 --- a/docs/docs/graphql-reference.md +++ b/docs/docs/graphql-reference.md @@ -44,7 +44,13 @@ In this query `filter` and the `ne` (not equals) operator is used to show only r -Gatsby relies on [Sift](https://www.npmjs.com/package/sift) to enable MongoDB-like query syntax for object filtering. This allows Gatsby to support operators like `eq`, `ne`, `in`, `regex` and querying nested fields through the `__` connector +Gatsby relies on [Sift](https://www.npmjs.com/package/sift) to enable MongoDB-like query syntax for object filtering. This allows Gatsby to support operators like `eq`, `ne`, `in`, `regex` and querying nested fields through the `__` connector. + +It is also possible to filter on multiple fields - just separate the individual filters by a comma (works as an AND): + +```js +filter: { contentType: { in: ["post", "page"] }, draft: { eq: false } } +``` A good video tutorial on this is [here](https://www.youtube.com/watch?v=Lg1bom99uGM).