JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://underscorejs.org/underscore-min.js"></script>
<script src="http://backbonejs.org/backbone-min.js"></script>
JavaScript
var MyModel = Backbone.Model.extend({
defaults: {
status: 0,
name: undefined
}
});
var MyCollection = Backbone.Collection.extend({
model: MyModel
});
var myCollection = new MyCollection();
// Status === 1, so WILL be returned
myCollection.add(new MyModel({ name: "foo", status: 1 }));
// Status === 1, so WILL be returned
myCollection.add(new MyModel({ name: "moo", status: 1}));
// Status !== 1 (taking the model.defaults) so will NOT be returned
myCollection.add(new MyModel({ name: "not me!"}));
console.log(myCollection.where({status: 1}));