I'm looking for a way to, from a backbone collection, retrieve some kind of array of one specific attribute.
var SomeModel = Backbone.Model.extend({
defaults: function() {
return {
attr1: "something",
attr2: "something",
attr3: "darkside"
};
}
});
var SomeCollection = Backbone.Collection.extend({
model: SomeModel,
url: '/data.json',
});
Now assume I have something like above and I only want a collection/array/similar with only the attribute 'attr3'. Is there any nice way to get this (not by manually iterating through the SomeCollection and building a new Collection)? My understanding from underscore function "filter" is that it returns the entire SomeModel based on a certain premise, i.e. this is not what I want. Ideas?
Thanks