From c8ccfb13738414e4ff8008c2af664c27dd0cecac Mon Sep 17 00:00:00 2001 From: Jakub Holy Date: Thu, 6 Dec 2018 13:44:13 +0100 Subject: [PATCH 1/2] Filter: Mention there can be multiple filters --- 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..a53cf92c6dd2a 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). From 5161170214fa54924d2c4aa01fe80a257384c45e Mon Sep 17 00:00:00 2001 From: Dustin Schau Date: Thu, 6 Dec 2018 10:19:51 -0600 Subject: [PATCH 2/2] Update graphql-reference.md --- docs/docs/graphql-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/graphql-reference.md b/docs/docs/graphql-reference.md index a53cf92c6dd2a..f2ed5a6acb11e 100644 --- a/docs/docs/graphql-reference.md +++ b/docs/docs/graphql-reference.md @@ -44,7 +44,7 @@ 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):