code: function getSubqueries (inQueries, orQueries, otherQuery, pageSize, rightKeys) {
          var subqueries = [],
              numberOfChunks,
              i,
              inQuery,
              orQuery,
              queryArray,
              from,
              to;
          //                                                   this is a stupid way to turn numbers into 1
          numberOfChunks = (orQueries.length / pageSize) + (!!(orQueries.length % pageSize));
  
          for (i = 0; i < numberOfChunks; i += 1) {
              inQuery = {};
              from = i * pageSize;
              to = from + pageSize;
  
              rightKeys.forEach(function (key, index) {
                  inQuery[rightKeys[index]] = {$in: inQueries[index].slice(from, to)};
              });
  
              orQuery = { $or: orQueries.slice(from, to)};
  
              queryArray = [ { $match: inQuery }, { $match: orQuery } ];
  
              if(otherQuery) {
                  queryArray.push({ $match: otherQuery });
                  //Push this to the end on the assumption that the join properties will be indexed, and the arbitrary 
                  //filter properties won't be indexed.
              }
              subqueries.push(queryArray);
          }
          return subqueries;
      }
docs: Get the paged subqueries