my Collection fetches a few records and I have to show only top 10 records from it. I attempted
this.collection.each(function(){
if (count == 10) break;
//pass model to view
});
unfortunately break does not work with each() API of underscore.js Refer here: how to break the _.each function in underscore.js
How do I write a filter to pluck only top 10 from the collection
this.collection.filter();
UPDATE: collection.first(10) fetched me filtered list. However, I still needed to chain .each() to this collection to process the collection items. collection.first() does not allow chain. Please refer to my selected answer for solution to this.