title: Filtering backbone collection on multiple attribtues
body: <p>Is this a good approach to filtering a backbone collection on multiple attributes:</p>
  
  <pre><code>filterData: function(params) {
      // store original data for clearing filters
      this.originalModels = this.models.slice();
      for (var key in params) {
          var val = params[key];
          // if we are dealing with multiple values in an array
          // i.e. ['ford','bmw','mazda']
          if (typeof val === "object") {
              var union = [];
              for (var k in val) {
                  var subval = val[k];
                  var matched = _.filter(this.models, function(house) {
                     return house.get(key) == subval; 
                  });
                  union = union.concat(matched);
              }
              this.models = union;
          } else {
             var results = _.filter(this.models, function(house) {
                 return house.get(key) == val;
             });
             this.models = results;
          }
      } // end for
      return this.reset(this.models);
  },
  clearFilters: function() {
      return this.reset(this.originalModels);
  }
  </code></pre>
  
  <p>I tested it and it allows me to filter a collection in the following manner:</p>
  
  <pre><code>filterParams = {brand:['ford','bmw','mazda'], color:black}
  
  carCollection.filterData(filterParams);
  </code></pre>
  
  <p>It seems to work, but I don't know if there is a better way of doing this. </p>
  
  <p>I tested the <code>Backbone.Collection.where()</code> method, but it does not work if I want to say <code>brand: ['bmw','mazda','ford']</code></p>