I have a collection that i want to group by counting the same values in its attribute. So i execute this:
_.countBy(T.collection,function(model){
return model.get('text')
})
where attribute is a string. This string is able to have letters (A-z), ':' and '_' (underscore). It hasn't whitespace.
But the code throws
Cannot call method 'get' of undefined.
I have also tried with
T.collection.countBy(function(model){
return model.get('text')
})
but it throws
Object [object Object] has no method 'countBy'