title: GraphQL query to filter db document
body: <p>I am writing an application using graphql, spring and mongodb. Here i want to perform some filter on db document using graphql.
  Below is the representation of single document from mongo collection:</p>
  <pre><code>
  
      {
          "data" : {
              "attribute1" : [
                  {
                      "key":"val1"
                      "region":"US"
                  },{
                      "key":"val2"
                      "region":"UK"
                  }
              ]
              "attribute2" : [
                  {
                      "nestedAttribute1": [
                          {
                              "key":"val3"
                              "region":"US"
                          },{
                              "key":"val4"
                              "region":"UK"
                          }
                      ]
                      
                  }
              ]
          }
      }
  
  </code></pre>
  <p>I want to filter the document, using GraphQL, with all the data where 'region' is 'US'.
  Expected output:</p>
  <pre><code>
  
      {
          "data" : {
              "attribute1" : [
                  {
                      "key":"val1"
                      "region":"US"
                  }
              ],
              "attribute2" : [
                  {
                      "nestedAttribute1": [
                          {
                              "key":"val3"
                              "region":"US"
                          }
                      ]
                  }
              ]
          }
      }
  
  </code></pre>
  <p>Is it possible to write a generic query across all the attributes?
  If not, are there any alternatives to GraphQL which support this filtering.</p>
  <p>Here is the schema that is exact representation for mongo collection
  <a href="https://pastebin.com/JxEPEGhp" rel="nofollow noreferrer">https://pastebin.com/JxEPEGhp</a></p>