title: How to use two conditon in one array?
body: <p>I have a list of task stored in Mongo, like below</p>
  
  <pre><code>{
  "name": "task1",
  "requiredOS": [
      {
          "name": "linux",
          "version": [
              "6.0"
          ]
      },
      {
          "name": "windows",
          "version": [
              "2008",
              "2008R2"
          ]
      }
  ],
  "requiredSW": [
      {
          "name": "MySQL",
          "version": [
              "1.0"
          ]
      }
  ]
  }
  </code></pre>
  
  <p>My purpose is to filter the task by OS and Software, for example the user give me below filter condition </p>
  
  <pre><code>{
  "keyword": [
      {
          "OS": [
              {
                  "name": "linux", 
                  "version": [
                      "6.0"
                  ]
              }, 
              {
                  "name": "windows", 
                  "version": [
                      "2008"
                  ]
              }
          ]
      }, 
      {
          "SW": [ ]
      }
  ]
  </code></pre>
  
  <p>}</p>
  
  <p>I need filter out all the task can both running on the windows2008 and Linux 6.0 by searching the "requiredOS" and "requiredSW" filed. As you seen, the search condition is an array (the "OS" part). I have a trouble when use an array as search condition. I expect the query to return me a list of Task which satisfy the condition.</p>
  
  <p>A challenging thing is that I need to integrate the query in to spring-data using @Query. so the query must be parameterized</p>
  
  <p>can anyone give me a hand ?</p>
  
  <p>I have tried a query but return nothing. my purpose is to use $all to combine two condition together then use $elemMatch to search the "requiredOS" field</p>
  
  <pre><code>{"requiredOS":{"$elemMatch":{"$all":[{"name":"linux","version":"5.0"},{"name":"windows","version":"2008"}]}}}
  </code></pre>