title: Using matchesQuery and include twice parse.com javascript
body: <p>I use include and matchesquery twice, though, on the second matchesquery, the restriction is not accepted. For example, in my code :</p>
  
  <pre><code>function findMe(){
  var controller = Parse.Object.extend("Controller"); 
  var controllerType = Parse.Object.extend("ControllerType"); 
  var Type = Parse.Object.extend("TypeMagazia");
  var CategoryMagazia = Parse.Object.extend("CategoryMagazia");   
  
  
      var queryControllerType = new Parse.Query(controllerType);
      var queryType = new Parse.Query(Type);          
      var queryCategoryMagazia = new Parse.Query(Type);   
  
  
      //start type 
      var typeTable = [];
        var cafebar = document.getElementById('cafe_bar');
        var club = document.getElementById('club');
        var restaurant = document.getElementById('restaurant');         
        var pistes = document.getElementById('pistes');
        //perasma value ston pinaka
        if(cafebar.checked){ typeTable.push(cafebar.value);}
        if(club.checked){ typeTable.push(club.value);}
        if(restaurant.checked){ typeTable.push(restaurant.value);}
        if(pistes.checked){ typeTable.push(pistes.value);}
        console.log(typeTable);
  
       //start category 
      var categoryTable = [];
      for( var i =0; i&lt;5; i++){
      var cat = "cat"+i;
      console.log(cat);
        var category = document.getElementById(cat);
        //perasma value ston pinaka
        if(category.checked){ categoryTable.push(category.value);}
      }
       console.log(categoryTable);
  
  
  
      for (var i = 0; i&lt;typeTable.length; i++){
  for (var j = 0; j&lt;categoryTable.length; j++){
  
                      queryControllerType.exists('objectId');
  
                      queryType.equalTo("TypeName", typeTable[i]);
                      queryCategoryMagazia.equalTo("CategoryName", categoryTable[j]);
  
  
  
                      queryControllerType.include('TypeMagaziaID');
                      queryControllerType.include('CategoryMagaziaID');                       
  
                      queryControllerType.matchesQuery('TypeMagaziaID', queryType);
                      queryControllerType.matchesQuery('CategoryMagaziaID', queryCategoryMagazia);
  
                      queryControllerType.ascending('objectId')
                      queryControllerType.find().then(function(results) {
                          console.log("results.length : "+results.length);
  
                           for (var k = 0; k &lt; results.length; k++) {
                               var object = results[k];                       
                               var typeB = object.get('TypeMagaziaID');
                               var catB = object.get('CategoryMagaziaID');
  
  
                               var nameType = typeB.get("TypeName");  
                               var nameCategory = catB.get("CategoryName");
  
                               console.log(" Id : "+object.id +" typeName : "+nameType +" CategoryName : "+nameCategory);
                           }
  
                   });
  
                  }
              }
  </code></pre>
  
  <p>The results after running the code are :  </p>
  
  <p>'results.length : 0"</p>
  
  <p>When I comment the second matchesquery and having chosen the parameter 'club' to be the first matchesquery </p>
  
  <pre><code>    queryControllerType.exists('objectId');
  
                      queryType.equalTo("TypeName", typeTable[i]);
                      queryCategoryMagazia.equalTo("CategoryName", categoryTable[j]);
  
  
  
                      queryControllerType.include('TypeMagaziaID');
                      queryControllerType.include('CategoryMagaziaID');                       
  
                      queryControllerType.matchesQuery('TypeMagaziaID', queryType);
                      //queryControllerType.matchesQuery('CategoryMagaziaID', queryCategoryMagazia);
  
                      queryControllerType.ascending('objectId')
                      queryControllerType.find().then(function(results) {
                          console.log("results.length : "+results.length);
  
                           for (var k = 0; k &lt; results.length; k++) {
                               var object = results[k];                       
                               var typeB = object.get('TypeMagaziaID');
                               var catB = object.get('CategoryMagaziaID');
  
  
                               var nameType = typeB.get("TypeName");  
                               var nameCategory = catB.get("CategoryName");
  
                               console.log(" Id : "+object.id +" typeName : "+nameType +" CategoryName : "+nameCategory);
                           }
  
                   });
  </code></pre>
  
  <p>I'm taking these results : </p>
  
  <blockquote>
    <blockquote>
      <p>results.length : 8  postMagaziaTypeCategory.php:400  Id : 8kl40HYG9J
      typeName : club CategoryName : bistro postMagaziaTypeCategory.php:400 
      Id : 91HGIQFRGj typeName : club CategoryName : disco
      postMagaziaTypeCategory.php:400  Id : Ddw6S8hl0Z typeName : club
      CategoryName : cockteil postMagaziaTypeCategory.php:400  Id :
      LtiIQXxOx6 typeName : club CategoryName : cockteil
      postMagaziaTypeCategory.php:400  Id : Yp6j0uJLL3 typeName : club
      CategoryName : bistro postMagaziaTypeCategory.php:400  Id : dMnMugrKfL
      typeName : club CategoryName : cockteil
      postMagaziaTypeCategory.php:400  Id : hCDeYHPLO3 typeName : club
      CategoryName : bistro postMagaziaTypeCategory.php:400  Id : ntrrKiNaFq
      typeName : club CategoryName : bistro</p>
    </blockquote>
  </blockquote>
  
  <p>I want to create something like this appeared on the picture : 
  <a href="https://i.stack.imgur.com/WN3Rs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WN3Rs.png" alt="enter image description here"></a></p>