PageSourceSearch

https://gatsby-starter-graphql-playground.netlify.app/component---…ath-docs-filter-mdx-4ed7723747206b4fa736.js

js gatsby-starter-graphql-playground.netlify.app collected 2026-10-03 10:49:25 UTC 8,764 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkgraphql_playground=self.webpackChunkgraphql_playground||[]).push([[175],{7639:function(e,t,n){n.r(t),n.d(t,{Head:function(){return d},default:function(){return h}});var a=n(6540),l=n(8453);function r(e){const t=Object.assign({pre:"pre",code:"code",span:"span",p:"p",a:"a",h2:"h2",ul:"ul",li:"li",strong:"strong",em:"em"},(0,l.RP)(),e.components);return a.createElement(a.Fragment,null,a.createElement(t.pre,{className:"language-graphql"},a.createElement(t.code,{className:"language-graphql"},a.createElement(t.span,{className:"token punctuation"},"{"),"\n  ",a.createElement(t.span,{className:"token property-query"},"allMarkdownRemark"),a.createElement(t.span,{className:"token punctuation"},"("),a.createElement(t.span,{className:"token attr-name"},"filter"),a.createElement(t.span,{className:"token punctuation"},":")," ",a.createElement(t.span,{className:"token punctuation"},"{")," ",a.createElement(t.span,{className:"token attr-name"},"frontmatter"),a.createElement(t.span,{className:"token punctuation"},":")," ",a.createElement(t.span,{className:"token punctuation"},"{")," ",a.createElement(t.span,{className:"token attr-name"},"title"),a.createElement(t.span,{className:"token punctuation"},":")," ",a.createElement(t.span,{className:"token punctuation"},"{")," ",a.createElement(t.span,{className:"token attr-name"},"ne"),a.createElement(t.span,{className:"token punctuation"},":")," ",a.createElement(t.span,{className:"token string"},'""')," ",a.createElement(t.span,{className:"token punctuation"},"}")," ",a.createElement(t.span,{className:"token punctuation"},"}")," ",a.createElement(t.span,{className:"token punctuation"},"}"),a.createElement(t.span,{className:"token punctuation"},")")," ",a.createElement(t.span,{className:"token punctuation"},"{"),"\n    ",a.createElement(t.span,{className:"token property"},"totalCount"),"\n    ",a.createElement(t.span,{className:"token object"},"edges")," ",a.createElement(t.span,{className:"token punctuation"},"{"),"\n      ",a.createElement(t.span,{className:"token object"},"node")," ",a.createElement(t.span,{className:"token punctuation"},"{"),"\n        ",a.createElement(t.span,{className:"token object"},"frontmatter")," ",a.createElement(t.span,{className:"token punctuation"},"{"),"\n          ",a.createElement(t.span,{className:"token property"},"title"),"\n        ",a.createElement(t.span,{className:"token punctuation"},"}"),"\n      ",a.createElement(t.span,{className:"token punctuation"},"}"),"\n    ",a.createElement(t.span,{className:"token punctuation"},"}"),"\n  ",a.createElement(t.span,{className:"token punctuation"},"}"),"\n",a.createElement(t.span,{className:"token punctuation"},"}"),"\n")),"\n",a.createElement(t.p,null,"In this query ",a.createElement(t.code,null,"filter")," and the ",a.createElement(t.code,null,"ne")," (not equals) operator is used to show only results that have a title. You can find a good video tutorial on this ",a.createElement(t.a,{href:"https://www.youtube.com/watch?v=Lg1bom99uGM"},"here"),"."),"\n",a.createElement(t.p,null,"Gatsby relies on ",a.createElement(t.a,{href:"https://www.npmjs.com/package/sift"},"Sift")," to enable MongoDB-like query syntax for object filtering. This allows Gatsby to support operators like ",a.createElement(t.code,null,"eq"),", ",a.createElement(t.code,null,"ne"),", ",a.createElement(t.code,null,"in"),", ",a.createElement(t.code,null,"regex")," and querying nested fields through the ",a.createElement(t.code,null,"__")," connector."),"\n",a.createElement(t.p,null,"It is also possible to filter on multiple fields - just separate the individual filters by a comma (works as an AND):"),"\n",a.createElement(t.pre,{className:"language-javascript"},a.createElement(t.code,{className:"language-javascript"},a.createElement(t.span,{className:"token literal-property property"},"filter"),a.createElement(t.span,{className:"token operator"},":")," ",a.createElement(t.span,{className:"token punctuation"},"{")," ",a.createElement(t.span,{className:"token literal-property property"},"contentType"),a.createElement(t.span,{className:"token operator"},":")," ",a.createElement(t.span,{className:"token punctuation"},"{")," ",a.createElement(t.span,{className:"token keyword"},"in"),a.createElement(t.span,{className:"token operator"},":")," ",a.createElement(t.span,{className:"token punctuation"},"["),a.createElement(t.span,{className:"token string"},'"post"'),a.createElement(t.span,{className:"token punctuation"},",")," ",a.createElement(t.span,{className:"token string"},'"page"'),a.createElement(t.span,{className:"token punctuation"},"]")," ",a.createElement(t.span,{className:"token punctuation"},"}"),a.createElement(t.span,{className:"token punctuation"},",")," ",a.createElement(t.span,{className:"token literal-property property"},"draft"),a.createElement(t.span,{className:"token operator"},":")," ",a.createElement(t.span,{className:"token punctuation"},"{")," ",a.createElement(t.span,{className:"token literal-property property"},"eq"),a.createElement(t.span,{className:"token operator"},":")," ",a.createElement(t.span,{className:"token boolean"},"false")," ",a.createElement(t.span,{className:"token punctuation"},"}")," ",a.createElement(t.span,{className:"token punctuation"},"}"),"\n")),"\n",a.createElement(t.h2,null,"Complete list of possible operators"),"\n",a.createElement(t.ul,null,"\n",a.createElement(t.li,null,a.createElement(t.code,null,"eq"),": short for ",a.createElement(t.strong,null,"equal"),", must match the given data exactly"),"\n",a.createElement(t.li,null,a.createElement(t.code,null,"ne"),": short for ",a.createElement(t.strong,null,"not equal"),", must be different from the given data"),"\n",a.createElement(t.li,null,a.createElement(t.code,null,"regex"),": short for ",a.createElement(t.strong,null,"regular expression"),", must match the given pattern. Note that backslashes need to be escaped ",a.createElement(t.em,null,"twice"),", so ",a.createElement(t.code,null,"/\\w+/")," needs to be written as ",a.createElement(t.code,null,'"/\\\\\\\\w+/"'),"."),"\n",a.createElement(t.li,null,a.createElement(t.code,null,"glob"),": short for ",a.createElement(t.strong,null,"global"),", allows to use wildcard ",a.createElement(t.code,null,"*")," which acts as a placeholder for any non-empty string"),"\n",a.createElement(t.li,null,a.createElement(t.code,null,"in"),": short for ",a.createElement(t.strong,null,"in array"),", must be an element of the array"),"\n",a.createElement(t.li,null,a.createElement(t.code,null,"nin"),": short for ",a.createElement(t.strong,null,"not in array"),", must NOT be an element of the array"),"\n",a.createElement(t.li,null,a.createElement(t.code,null,"gt"),": short for ",a.createElement(t.strong,null,"greater than"),", must be greater than given value"),"\n",a.createElement(t.li,null,a.createElement(t.code,null,"gte"),": short for ",a.createElement(t.strong,null,"greater than or equal"),", must be greater than or equal to given value"),"\n",a.createElement(t.li,null,a.createElement(t.code,null,"lt"),": short for ",a.createElement(t.strong,null,"less than"),", must be less than given value"),"\n",a.createElement(t.li,null,a.createElement(t.code,null,"lte"),": short for ",a.createElement(t.strong,null,"less than or equal"),", must be less than or equal to given value"),"\n",a.createElement(t.li,null,a.createElement(t.code,null,"elemMatch"),": short for ",a.createElement(t.strong,null,"element match"),", this indicates that the field you are filtering will return an array of elements, on which you can apply a filter using the previous operators"),"\n"),"\n",a.createElement(t.p,null,"If you want to understand more how these filters work, looking at the corresponding ",a.createElement(t.a,{href:"https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/schema/__tests__/run-query.js"},"tests")," in the codebase could be very useful."))}var s=function(e){void 0===e&&(e={});const{wrapper:t}=Object.assign({},(0,l.RP)(),e.components);return t?a.createElement(t,e,a.createElement(r,e)):r(e)},c=n(557),o=n(6835),m=n(3765),u=n(1178),p=n(7899),i=n(70);const E=e=>{let{data:{playground:t},children:n}=e;return(0,c.Y)(m.A,null,(0,c.Y)("section",{sx:{"pre:first-of-type":{display:"none"},maxWidth:"900px"}},(0,c.Y)(o.DZ,{as:"h1",variant:"styles.h1","data-testid":"item-title"},t.title),n),(0,c.Y)("section",null,(0,c.Y)(p.A,null,(0,c.Y)(u.A,{title:t.title,query:t.query}))))};function h(e){return a.createElement(E,e,a.createElement(s,e))}const d=e=>{let{data:{playground:t}}=e;return(0,c.Y)(i.A,{title:t.title})}}}]);
2//# sourceMappingURL=component---node-modules-lekoarts-gatsby-theme-graphql-playground-src-templates-item-tsx-content-file-path-docs-filter-mdx-4ed7723747206b4fa736.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.